Exercise 3 of Intro to python class