''' Purpose: introduction to dictionary' ''' mappings = {} # dictionary are denoted by {} - for now, it's empty mappings[ 0 ] = 'even' # { 0 : 'even' } mappings[ 1 ] = 'odd' # { 0 : 'even', 1 : 'odd' } mappings[ 2 ] = 'even' # { 0 : 'even', 1 : 'odd', 2 : 'even' } mappings[ 3 ] = 'odd' # so on mappings[ 4 ] = 'even' # but the order is sort of random, we don't know what the order is 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 ] # get the value at the key n print( n, status ) reply = input( 'Enter even or odd: ' ) meaning = mappings[ reply ] # get the value for the key reply where reply is the string 'even' or 'odd' print( meaning )