correction proposed for Index in Strings 3.1.2
One way to remember how slices work is to think of the indices as pointing between characters, with the left edge of the first character numbered 0. Then the right edge of the last character of a string of n characters has index n, for example:
+++++++
 P  y  t  h  o  n 
+++++++
0 1 2 3 4 5 6
6 5 4 3 2 1
However, the index of the last character is 5 not 6, granted the way it is stated the right edge of the last character has the number 6, but that is mixing index and count. You could say “Then the left edge of the last character of a string of n characters has index n1, where n is the count of characters beginning at 1 (one)…”
y = ['P', 'y', 't', 'h', 'o', 'n'] x = y.index("P") print(x)
0
x = y.index("o") print(x)
4
x = y.index("n") print(x)
5
Sam Duncan
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
participants (1)

Samuel DUNCAN