Posts Tagged ‘reverse’

One line code to reverse a string in Python:

strOrig = “xyz”

revStr = s[::-1]

where ‘strOrig’ is the source string and ‘revStr’ is the string reversed.

Python is indeed powerful!!