MemotivaSequences and slicing

How do you reverse a sequence using slicing?

Sequences and slicing

Audio flashcard · 0:17

Nortren·

How do you reverse a sequence using slicing?

0:17

To reverse a sequence, use a slice with a step of negative one and no start or stop. For a list named items, items with brackets containing colon colon negative one returns a new list with elements in reverse order. This is concise but creates a copy. For in-place reversal, use the reverse method.
docs.python.org