I am learning python and I confused on why getting a string subset using the code below works.
s = 'a' print(s[1:])
Since this is a string of length one s[0:] would work since python is 0 indexed. Can somebody help explain why the s[1:] works?
My understanding of substrings is as follows:
string[start:end] = Get all characters from index start to end-1
string[:end] = Get all characters from the beginning of the string to end-1
string[start:] = Get all characters from index start to the end of the string
string[start:end:step] = Get all characters from start to end-1 discounting every step character