Data structuresList slices
Taking a slice
List indices begin at zero. a[start:stop] builds a new list from start up to, but excluding, stop. len counts its elements.
Code example
a = [10, 20, 30, 40]
part = a[1:3] Walkthrough
a[1:3] picks indices 1 and 2, producing [20, 30], which has two elements.