The first three letters
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
This one builds on a lesson you haven't finished yet. Do that lesson first:
Python Basics · Working with strings →
The first three letters
word is "python". Store its first three characters in part using a slice.
⚠️ A slice stops before its second number. word[:3] gives three characters — positions 0, 1, 2 — and never position 3. So the number you write is the COUNT you want, not the last position.
word is "python". Store its first three characters in part using a slice.
Click Run to see the output here.