Code Lab

Array Indexes

a = [1, 2, 3, 4, 5] print(a[::2]) # iterate over the whole list in 2-increments print(a[::-1]) # a useful idiom for 'x reversed'
:
Input
Input Data (stdin):
Output
[1, 3, 5]
[5, 4, 3, 2, 1]