0

Python shortcut exercise question

c = [$, €, £, ¥] Use negative indexing to output the 4th element in the list. print(c[___]) What should be the value in the blanks -4 was wrong.....

28th Feb 2025, 1:56 PM
Shikha Sen
Shikha Sen - avatar
1 Odpowiedź
+ 1
When using negative indexing, the selection starts from the end of the list, going left as you decrease the value more. The 4th item(which is the last item) has an index of -1, not -4.
28th Feb 2025, 2:10 PM
Afnan Irtesum Chowdhury
Afnan Irtesum Chowdhury - avatar