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


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?


2 Answers

New Answer


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


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??