MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PythonLearning/comments/1msspug/whats_wrong/n98a5at/?context=3
r/PythonLearning • u/Nearby_Tear_2304 • Aug 17 '25
45 comments sorted by
View all comments
33
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
4
This is the answer, good stuff
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.