Skip to Content
Advanced Topics in Python
List Slicing

Great! Next up: list slicing.

str = "ABCDEFGHIJ" start, end, stride = 1, 6, 2 str[start:end:stride]

You can think of a Python string as a list of characters.



The string in the editor is garbled in two ways:

  1. Our message is backwards.
  2. The letter we want is every other letter.

Use list slicing to extract the message and save it to a variable called message.

Folder Icon

Take this course for free

Already have an account?