Psst! Check what courses we have in our offer, and get them all here to save $727. Act fast–this deal is available only 3/14–3/21.
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.