Problem Set 05 - Question 2 code