Think Python ch18 ex6.5