Why does the following indexing throws error
string = "ABC"
string[4]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
but not when
string[4:]
''
Why does the following indexing throws error
string = "ABC"
string[4]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
but not when
string[4:]
''