0
could someone please explain the answer briefly
a=[0,1,2,3] for a[-1] in a: print(a[-1])
2 Answers
+ 3
for x in y means:
'Please let x be each element of y consecutively.'
This is comparable to you just writing:
x = y[0]
x = y[1]
and so forth.
Now for a[-1] means that instead of a variable x, the last slot of a is taken as the 'vessel' where each element will be stored.
+ 1
Thank you HonFu