>> Assuming that mytext is "test", I've found that mytext[-1:-4:-1]
>> doesn't work (as I expected it to) but that mytext[::-1] does.
>>
>> While that's fine, I just wondered why mytext[-1:-4:-1] doesn't work?
>
> How does it not "work"? What did you expect to happen? What did it do instead?
>
> Greets
> Sander
>

Hi, assuming mytext is "test", word[-1:-4:-1] returns tse

My understanding of how the index works on test would be:

0  1  2  3
t   e  s   t
-4 -3 -2 -1

So I just wasn't clear on what happened to the last 't' I expected to see.

Cheer,

Chris
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to