0

What will be the output?Explain with proper solution...

a = [0, 1, 2, 3] for a[-1] in a: print(a[-1])

29th Feb 2020, 7:33 AM
Rakesh Minase
Rakesh Minase - avatar
4 Answers
+ 2
Negative indexes mean you count backwards. In you case index 3 is index -1, since it's the last one.
29th Feb 2020, 7:37 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
So what is the answer
29th Feb 2020, 7:57 AM
Rakesh Minase
Rakesh Minase - avatar
29th Feb 2020, 8:15 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
0 1 2 2
29th Feb 2020, 8:16 AM
Fernando Pozzetti
Fernando Pozzetti - avatar