0

list = [0,1,2] for i, v in enumerate(list): print(v+i,end =") #output:024 why?

enumerate

31st Oct 2021, 8:28 AM
Khalif BabyđŸ‘¶
Khalif BabyđŸ‘¶ - avatar
2 Answers
+ 6
you have 3 indexes so you also have 3 values. indexes: 0 1 2 values : 0 1 2 enumerate goes through an iterable and assigns each value with it's index value in a tuple. PRINT IT OUT IN THE PLAYGROUND. when you use: print(end='') the end paramater assigns a new ending character. (instead of '\n' which is default.) Then you just add the indexes and values and squish em together. 024
31st Oct 2021, 8:50 AM
Slick
Slick - avatar
+ 1
0+0, 1+1, 2+2
31st Oct 2021, 10:43 AM
Shadoff
Shadoff - avatar