ex6 from Learn Python The Hard Way