Fill in the blank to iterate over the value of dictionary and update value to zero. for index in temp.____ { temp[index]=0 } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Fill in the blank to iterate over the value of dictionary and update value to zero. for index in temp.____ { temp[index]=0 }

24th Jun 2016, 5:00 PM
Kris -
Kris - - avatar
7 Answers
+ 2
for index in temp.keys{ temp[index]=0 }
26th Jun 2016, 12:42 PM
Svetlana Milutinović
Svetlana Milutinović - avatar
+ 1
You need to update value to zéro so you need to iterrate on the keys of each index in temps.
25th Jun 2016, 8:59 PM
Fafabz974
Fafabz974 - avatar
+ 1
Dictionaries uses Keys and Values
6th Oct 2016, 7:29 PM
Ryan Lewis
Ryan Lewis - avatar
0
someone explain this please
24th Jun 2016, 7:07 PM
Kris -
Kris - - avatar
0
thanks
27th Jun 2016, 6:26 AM
Kris -
Kris - - avatar
0
this is simple to understand ! see goal of every programming language is to things what they are in real world. Now just think how will you show a dictionary " simply some search parameter and it's value . now when you are doing .keys you are trying to access keys and by for loop you are iterating on each key and setting it's value to zero
2nd Sep 2016, 10:39 AM
Inder Mishra
Inder Mishra - avatar
0
for index in temp.keys{ temp[index]=0 }
24th Sep 2018, 7:03 AM
Md. Abdullah Al Rafiul Hasan
Md. Abdullah Al Rafiul Hasan - avatar