how do you get a value from a dictionary and return the key' code example
Example 1: how to get key of a particular value in dictionary python using index
mydict = {'george': 16, 'amber': 19}
print(list(mydict.keys())[list(mydict.values()).index(16)])
Example 2: how to write a dict in pytohn
my_dict = {'name': 'Jack', 'age': 26}
print(my_dict['name'])
print(my_dict.get('age'))
Example 3: get a value from a dictionary python
dict = {'Name': 'Zabra', 'Age': 7}
print "Value : %s" % dict.get('Age')
print "Value : %s" % dict.get('Education', "Never")