Py in range | SoloLearn: Learn to code for FREE!

+1

Py in range

Please explain output : a=[2,4,5] for i in range(1,3): a[i]=a[i-1] print(a[i],end="") output 22?

py

2 Answers

New Answer

+5

a[1]=a[0]=2 a[2]=a[1]=2

+3

So in the first line a[1]=2; and in the second line after a[2]=a[1]=2 repeats the same value????? same pattern??