Python Quest

Track 6 · Lesson 3 of 12

Slicing: taking part of a list

Take ranges of items with start:stop:step slices, copy lists with [:], and reverse with [::-1].

About 35 minBeginner4 exercises

You will be able to

  • Write slices with start, stop and step, including omitted and negative values
  • Explain why the stop index is excluded and why slices never raise IndexError
  • Copy a list with a slice and reverse it with a negative step
  • Use slices to split data into pages, windows and halves

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.