Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Quick recap
Indexing and slicing
15. Index out of range


Good job! Let's do one final experiment with string indices. What happens when you try to access a non-existent element?


Take a look at the template code. Try to access an element that is not present in the string.

For instance, try first_letters[7] or first_letters[-9].

In both cases, we get an IndexError: string index out of range. That's not a problem when we're testing things, but when your users encounter this, their programs will stop working (crash)!

When you're done, click Next exercise to continue.