''' Purpose: introduction to dictionary' ''' mappings = {} mappings[ 0 ] = 'even' 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' # x = mappings[key] -> gives you value if the # key is in our dictionary otherwise it blows up # Your keys and values can be whatever you want. # As long as you don't repeat keys. reply = input( 'Enter a number: ' ) n = int( reply ) status = mappings[ n ] # mappings[key] is getting the value at a key in the # the dictionary mappings print( n, status ) reply = input( 'Enter even or odd: ' ) meaning = mappings[ reply ] print( meaning )