+ 2
How to search the value in dictionary?
3 Answers
+ 6
Loop over keys and use dict[key] to get the values for comparison
https://code.sololearn.com/cSUh5n218k3Y/?ref=app
+ 3
Dict.values()
0
dictionary = {1:2, 2:3, 3:3}
def searchvalue(n, value):
for key, val in n.items():
if key == value:
print(â foundâ, key,â:â,val)
searchvalue(dictionary, 2)