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 ?
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 ?
read up on list slicing.
This is the same question asked by another user.
Explain Python's slice notation