+ 1

can any one explain me this program how dictionary is updated

https://code.sololearn.com/cXGBghPJeFnr need a good explanation

20th Sep 2020, 9:23 AM
Gireesh Desineni
Gireesh Desineni - avatar
3 Respostas
+ 3
when loop runs first x[n] is assigned 'b' So x[1]="b" Then n is incremented and is 2 now Again x[2] is assigned the next value in arr i.e. 'c' So x[2]='c' and so on
20th Sep 2020, 9:27 AM
Abhay
Abhay - avatar
+ 1
Abhay... for x[n] in arr... Are we assigning array values to x[key]?
20th Sep 2020, 9:31 AM
Gireesh Desineni
Gireesh Desineni - avatar
0
Gireesh Desineni yes For example When the following loop runs for i in arr: print(i) What does i prints? All the values in arr and for it to do that each value from arr is assigned to i
20th Sep 2020, 10:15 AM
Abhay
Abhay - avatar