0

I tested the following python code which reverses a string

>> s = 'abcd'
>> s[::-1]
>> 'dcba'

But I am confused, what exactly the two comma and negative one does it the code ?

DQI
  • 725
  • 1
  • 5
  • 7
  • 3
    A great description is given here: http://stackoverflow.com/questions/509211/explain-pythons-slice-notation – mitoRibo Jul 21 '16 at 00:42

1 Answers1

0

read up on list slicing.
This is the same question asked by another user. Explain Python's slice notation

Community
  • 1
  • 1
monoshiro
  • 78
  • 7