pairs = {1: "apple", "orange": [2, 3, 4], True: False, 12: "True", } print(pairs.get("orange")) print(len(pairs)) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

pairs = {1: "apple", "orange": [2, 3, 4], True: False, 12: "True", } print(pairs.get("orange")) print(len(pairs))

Why does the len() function print 3 ?????

24th Mar 2022, 3:27 PM
Eyob Yifru
Eyob Yifru - avatar
2 Answers
+ 3
Eyob Yifru Because 1 means True So 1 will be override by True and dictionary will have 3 keys
24th Mar 2022, 3:28 PM
A͢J
A͢J - avatar
+ 1
Thank you!!
24th Mar 2022, 3:29 PM
Eyob Yifru
Eyob Yifru - avatar