batman = "Bruce Wayne"
first = batman[0] # Accessing the first character
print(first)
space = batman[5] # Accessing the empty space in the string
print(space)
**last = batman[len(batman) - 1]**
** print(last)**
# The following will produce an error since the index is out of bounds
# err = batman[len(batman)]
In the bolded code, why is “e” printed instead of “n” as the output?
I read the [len(batman) - 1] to simplify to [11 - 1] as the length of (batman) is 11 characters. So, shouldn’t print(last) where last = batman[10] end up at the “n” rather than the “e”? As in, the blank space is included in the character count, correct?