The last letter
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 last letter
word is "python". Store its last character in last, without counting the letters yourself.
A negative position counts from the end: word[-1] is the last character, word[-2] the one before it. It works whatever the length.
word is "python". Store its last character in last, without counting the letters yourself.
Click Run to see the output here.