[Tutor] Counting a string backwards

C W tmrsg11 at gmail.com
Sun May 28 13:58:22 EDT 2017


Dear Python list,

I am having trouble understanding the following.

If I do case 1,
great = "Machine learning is awesome!"
> print(great[-1])
> !

Now if I do case 2,
> print(great[-3:-1])
> me

Where did the exclamation mark go in case 2?

I was told the count begins at zero, that's true going forward, but not
backwards.

What is wrong?

Thank you!

Mike


More information about the Tutor mailing list