Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
added 48 characters in body
Source Link
ncmathsadist

It slices

x[startAt:endBefore:skip]

if you use skip = 2, every other element the list beginning at startAt and ending at endBefore will be selected. [Remember: indices live BETWEEN list elements]

To see this, enter

x = range(100)

at the Python prompt. Then try these things

x[::2]
x[::3]
x[10:40:6]

and see what happens.

It slices

x[startAt:endBefore:skip]

if you use skip = 2, every other element the list beginning at startAt and ending at endBefore will be selected.

To see this, enter

x = range(100)

at the Python prompt. Then try these things

x[::2]
x[::3]
x[10:40:6]

and see what happens.

It slices

x[startAt:endBefore:skip]

if you use skip = 2, every other element the list beginning at startAt and ending at endBefore will be selected. [Remember: indices live BETWEEN list elements]

To see this, enter

x = range(100)

at the Python prompt. Then try these things

x[::2]
x[::3]
x[10:40:6]

and see what happens.

Source Link
ncmathsadist

It slices

x[startAt:endBefore:skip]

if you use skip = 2, every other element the list beginning at startAt and ending at endBefore will be selected.

To see this, enter

x = range(100)

at the Python prompt. Then try these things

x[::2]
x[::3]
x[10:40:6]

and see what happens.

lang-py