Don't understand this python function

  • Context: Python 
  • Thread starter Thread starter zeion
  • Start date Start date
  • Tags Tags
    Function Python
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
zeion
Messages
455
Reaction score
1

Homework Statement



Hi,

I'm not sure what this does:

s = 'hello'

I understand

s[::-1] would reverse the order of the letters and
s[1::] slices the first letter

but how come

s[1::-1] returns 'eh' ?


Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org