Finished exercise 17 in python book.