''' Purpose: introduction to dictionary' ''' # An empty list is [] # An empty dictionary is {} # Welcome to the world of dictionaries. mappings = {} # Initializes an empty dictionary. # I put things in my dictionary like so: # dictionary_name[ key ] = value # spanish_to_english[ 'hola' ] = hello is an example. mappings[ 1 ] = 'odd' mappings[ 2 ] = 'even' mappings[ 3 ] = 'odd' mappings[ 4 ] = 'even' mappings[ 5 ] = 'odd' mappings[ 6 ] = 'even' mappings[ 7 ] = 'odd' mappings[ 8 ] = 'even' mappings[ 9 ] = 'odd' mappings[ 'even' ] = 'a number is even if its remainder divided by 2 is 0' mappings[ 'odd' ] = 'a number is odd if its remainder divided by 2 is 1' reply = input( 'Enter a number: ' ) n = int( reply ) status = mappings[ n ] # So we said we wanna know what n is mapped to. print( n, status ) # This prints out n (the key) and its value (what it's # mapped to) reply = input( 'Enter even or odd: ' ) meaning = mappings[ reply ] print( meaning )