+ 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)

2nd Feb 2022, 10:25 AM
Manoj Bhaagam
3 Answers
+ 1
Slick , you code doesn't work with nested dict, needs some changes
2nd Feb 2022, 12:10 PM
Vitaly Sokol
Vitaly Sokol - avatar
2nd Feb 2022, 9:22 PM
Slick
Slick - avatar
2nd Feb 2022, 10:52 AM
Slick
Slick - avatar