0
Whats wrong with the python
list = [1, 2, 3, 4] print(list[4])
5 Respuestas
+ 5
Counting of index starts with 0 so at to acess 4 write it list[3]
+ 14
Indexing starts with 0. There is no index 4 when the list has only 4 elements.
+ 2
This list only have 0 to 3 index
It means [1,2,3,4]
0,1,2,3
+ 1
[1,2,3,4]
0 1 2 3
Working in slice to list[3:4] or list[:4], but not working with call to list[4] (list index out of range)
+ 1
on all languages, no matter, C, Java, Python, anything starting from 0, not 1 like u got used to it. Read attentively lessons