#0based — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #0based, aggregated by home.social.
-
It means the index you supplied is past the end of the list, or before the beginning. List indices start at 0, which sometimes trips people up.
>>> l = [1, 2, 3]
>>> l[2]
3
>>> l[-3]
1
>>> l[3]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> l[-4]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of rangeHappy to look at code if you post it.
-
One point I've never seen mentioned in the Array Indexing Wars is that source code is always numbered from 1.
Like, even the C standard mandates that the first line of code in a file is numbered 1
-
One point I've never seen mentioned in the Array Indexing Wars is that source code is always numbered from 1.
Like, even the C standard mandates that the first line of code in a file is numbered 1
-
One point I've never seen mentioned in the Array Indexing Wars is that source code is always numbered from 1.
Like, even the C standard mandates that the first line of code in a file is numbered 1
-
One point I've never seen mentioned in the Array Indexing Wars is that source code is always numbered from 1.
Like, even the C standard mandates that the first line of code in a file is numbered 1
-
One point I've never seen mentioned in the Array Indexing Wars is that source code is always numbered from 1.
Like, even the C standard mandates that the first line of code in a file is numbered 1