"Then we access a slice of "Charlie" using s[1:4].
This returns everything from the letter at position 1 up till position 4."

If this return position 1 up till 4, shouldn't it return "harl" instead?


no? charlie has the following indexes:

C   h    a   r   l   i   e
0    1   2   3   4   5   6

its for the indexes lesser then (<) four, not lesser then or equal to (<=) four


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.