''' Purpose: demonstrate dict mappings ''' # get access to url support import url # where is the dog to notoriety mappings PUPPIES_CSV = "http://www.cs.virginia.edu/~cs1112/datasets/csv/puppies.csv" # get dictionary notoriety = url.get_dictionary( PUPPIES_CSV ) # ***WE CHANGED THIS FROM get_dataset() to get_dictionary() interested = True # initialize our test condition / loop variable here ( starts with True for a while loop ) #**** == tests equality, = is assignment **** while ( interested == True ) : # the == True is unnecessary for python but useful for intro coders! # as long as interested is True, continue doing this. must set interested to False at some point to exit the loop # ask for dog of interest reply = input( "Enter name of dog: " ) dog = reply.strip() dog = dog.capitalize() # when you clean up input, make sure your cleaned up version matches whatever you're looking in # this won't work for Brian Griffin because capitalize only works on the first letter of a string if ( dog == "" ) : interested = False # exit condition - changes test expression if empty string is entered else : # look up claim to fame fame = notoriety.get( dog ) print( fame ) print()