KwickClips Python · 46 sec · free
MUMBAI has six letters. Is the last one at index 6?
Short answer. No. The last letter I is at index 5, or -1.
Where does negative indexing start?
It starts at -1 for the last character and counts from the right.
The index ruler
| Letter | Positive | Negative |
|---|---|---|
| M | 0 | -6 |
| U | 1 | -5 |
| A | 4 | -2 |
| I | 5 | -1 |
Remember
| Left starts at 0 |
| Right starts at -1 |
Mumbai has six letters. Last at index six? No. Each letter has two indexes. First is zero, or minus six. Next is one, or minus five. A is four, or minus two. Last is five, or minus one. Left starts at zero. Right starts at minus one.
This clip is from the full lesson: Strings: Indexing, Slicing and String Operations — 8 minutes, with the tables, the quick answers and the whole lesson in text.
Useful for: CBSE Class 11 Computer Science (083), CBSE Class 11 Computer Science (083), CBSE Class 11 Computer Science Essentials (083), CBSE Class 11 Computer Science Essentials (083)
More KwickClips from this lesson
Can you reverse a string without a loop?41 sec
What does * do to a string?42 sec
How do you check each letter of a word?37 sec
Can you change one letter of a string?41 secVoice-over is AI-generated; the script is written and checked by Kajal Ma'am. Confirm anything you plan around against your official board document. We never ask for a password or an OTP.

