Simple Python String (Backward) Slicing

Viewed 2932

Yeah I know there are a lot of similar questions up there. But I just cannot find what I was looking for.

My confusion is about the backward slicing.

my_jumble = ['jumbly', 'wumbly', 'number', 5]
print(my_jumble[:1:-1])

Now I have found that the result will be

[5, 'number']

So I thought that maybe I will test it out by changing the ends in that string slicing.

print(my_jumble[:2:-1])

I was really sure that Python would give me something like

[5, 'number', 'wumbly']

Instead it gave me this which made me totally lost...

[5]

Can someone explain what is going on here? I am new to Python and find this very confusing.. Thanks for any help.

4 Answers
Related