Master list & string slicing β from basics to the trickiest edge cases.
Difficulty
[1, 2, 3]
'abc'
The syntax is seq[start:stop:step]
seq[start:stop:step]
-1 is the last element, -2 second-to-last, and so on.
-1
-2
a[:]
a[::-1]
a[::2]
a[1:-1]
a[-3:]
a[1:3] = [9]