r/PythonLearning • • Aug 17 '25

What's wrong

Post image
49 Upvotes

45 comments sorted by

View all comments

33

u/JestemStefan Aug 17 '25

I see no answer explaining error message itself so here it is:

Length of your list is 5 (n = 5)

But list indexes start from 0 so only valid values are: 0, 1, 2, 3, 4.

You tried to access element at index 5 which doesn't exists.

4

u/igotthis35 Aug 17 '25

This is the answer, good stuff