Exercise 48 from Learn Python the Hard Way