0

why -1 ???

since len(words) gives me the number of elements in the list why is it important to put -1 ?

18th Jul 2017, 6:24 AM
ali
2 Respostas
+ 4
Depends on what you want to do. If you want to iterate through a list, you have to remember its last element's index equals to its length minus 1 (because it starts counting from 0, not from 1).
18th Jul 2017, 6:26 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
thanks mate
19th Jul 2017, 3:55 PM
ali