May-31-2020, 05:11 AM
Please, can someone help me explain why this reverse lookup is not working. If I input any of the values in the dictionary, it says not found. Baffled.
mydict = {'a':2, 'b':4, 'c': 5, 'u':98} #do reverse lookup v = input('enter a key >') def reverse_lookup(d, v): for keys in d : if d[keys] == v : print('found') return keys else : print('not found') print(reverse_lookup(mydict, v))Thanks