How to Check the Exact Match Dictionary in Python

The Python language lets you create an internal dictionary for keeping a list of values in a list variable. The dictionary list has a key value and the full-name matching word. You use the key value to call and "match" the key to the full-name value. You use the "lookup" function to do an exact match find on the dictionary list variable.

Instructions

    • 1

      Open your preferred Python editor and open the project you want to use to do a dictionary lookup. Open the source code file you want to use.

    • 2

      Create the dictionary list. You can create several lists if you need to have more than one dictionary list values. The following code makes a list of colors:

      color_dictionary= {
      'O': 'orange',
      'R': 'red',
      'B': 'blue'
      }

    • 3

      Perform a "get_key" lookup to determine the color that matches the color key. For instance, to return "orange" to the Python code, the following code performs a dictionary lookup:

      find = match('O')

    • 4

      Write the output to the screen. The following returns the value returned from the lookup function:

      print find

Related Searches:

References

Comments

Related Ads

Featured