added soultion for chapter [3.1 - 3.6)