Adding answer for homework 5.2