Skip to content

Glossary: Data Structures and Algorithms

Slice

Also written: slices, slicing, [::-1]

A piece of a list or string taken with `items[a:b]`, which makes a copy costing O(k). A step of -1 (`[::-1]`) gives a reversed copy.

Where the book teaches it

Related terms

In place