Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

access key through value python


dictionary = {'george': 16, 'amber': 19}
search_age = input("Provide age")
for name, age in dictionary.items():  # for name, age in dictionary.iteritems():  (for Python 2.x)
    if age == search_age:
        print(name)

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #access #key #python
ADD COMMENT
Topic
Name
6+1 =