How this is being executed?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How this is being executed??

a=[1,2,3] a[1,0]=[11,22] 2nd line how works??

27th Sep 2020, 3:16 PM
[bool left=True;]
[bool left=True;] - avatar
2 Answers
+ 2
The 1 in a[1,0] seems to be for the position, the 0 for number of values to be replaced. So at position 1 numbers 11 and 22 are added. There are no values replaced. Simply test if it is true with a code like this: a=[1,2,3] a[0,0]=[11,22] print(a, "\n") a=[1,2,3] a[1,0]=[11,22] print(a, "\n") a=[1,2,3] a[1,1]=[11,22] print(a, "\n") a=[1,2,3] a[1,2]=[11,22] print(a, "\n") i didn't look up how it works, I only tested it.
27th Sep 2020, 3:36 PM
Paul
Paul - avatar
+ 1
Paul Thank you
27th Sep 2020, 3:38 PM
[bool left=True;]
[bool left=True;] - avatar