assignment2 - problem 6