0

Output is 00301 i don't got it

print('Hello world!') A=[1,2,3,4,1] for n in A: A[n]=0 print(A)

10th May 2021, 6:03 PM
divyanand yadav
divyanand yadav - avatar
1 Answer
+ 6
So look at the transformation of A -zero index in A A[1] = 0 A = [0,0,3,4,1] -first index in A A[0] = 0 A = [0,0,3,4,1] -second index in A A[3] = 0 A = [0,0,3,0,1] -third index in A A[0] = 0 A = [0,0,3,0,1] -fourth index in A A[1] = 0 A = [0,0,3,0,1] If you study this very well, you'll understand the meaning of that loop
10th May 2021, 7:02 PM
Mirielle
Mirielle - avatar