Actually just realised an even more concise way in Python. The slice operator takes a step as an optional 3rd argument, and I just found out the step can be negative.
>>>str="Reverse me!">>>str[::-1]'!em esreveR'
So...
defrevFunction(str):returnstr[::-1]
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Actually just realised an even more concise way in Python. The slice operator takes a
step
as an optional 3rd argument, and I just found out the step can be negative.So...