Python Data Structures Coursera Assignment 7.2