+ 2

How to search the value in dictionary?

7th Sep 2019, 3:36 AM
gancer
gancer - avatar
3 odpowiedzi
+ 6
Loop over keys and use dict[key] to get the values for comparison https://code.sololearn.com/cSUh5n218k3Y/?ref=app
7th Sep 2019, 3:42 AM
Gordon
Gordon - avatar
+ 3
Dict.values()
19th Sep 2019, 5:49 PM
Shivangi Soti
Shivangi Soti - avatar
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)
25th Sep 2019, 2:48 PM
Javier Hdez
Javier Hdez - avatar