Indexes begin at zero, and slices stop before the end.
Use square brackets after a list name to access an item. Positive indexes count from the start; negative indexes count backward from the end.
numbers = [10, 20, 30, 40, 50]
print(numbers[0])
print(numbers[-1])numbers[0] is the first item and numbers[-1] is the final item.
10
50A slice uses start:stop:step. The start is included, but the stop position is not included.
Slice boundary: numbers[1:4] contains positions 1, 2, and 3, but not position 4.
numbers = [10, 20, 30, 40, 50]
print(numbers[::2])An omitted start and stop use the full list; step 2 selects every second item.
