+ 2
I want to check weather number present in the dictionary or not ?- Nested dictionary
def check(check,number): for key,value in check.items(): if number is (key,value): print("yes") else: print("No") check({1:{2:{3:{4:5}}}},4)
3 Antworten
+ 1
Slick , you code doesn't work with nested dict, needs some changes
+ 1
Thanks Vitaly Sokol revised.
https://code.sololearn.com/criHdBA803x6/?ref=app
0
Use recursion
https://code.sololearn.com/c6qp9AgoqL1A/?ref=app