How to findthe length of the given dictionary by using for loop...? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to findthe length of the given dictionary by using for loop...?

Given dictionary is: squares = {1: 1, 3: 9, 5: 25, 7: 49, 9: 81}

24th May 2022, 2:16 PM
Mihir Lalwani
Mihir Lalwani - avatar
3 Answers
+ 2
Setup a variable named <size>, initialize it by zero Run a for...in loop on the <squares> dictionary Increment <size> on each loop iteration
24th May 2022, 2:50 PM
Ipang
+ 4
Ya i try this sol.. and its compile..
24th May 2022, 2:51 PM
Mihir Lalwani
Mihir Lalwani - avatar
+ 2
Do you have a code where you've tried?
24th May 2022, 2:25 PM
Justice
Justice - avatar