reverse functions on strings implementation python code example
Example 1: reverse string in python
'hello world'[::-1]
'dlrow olleh'
Example 2: reverse a string python
string = 'abcd'
''.join(reversed(string))
'hello world'[::-1]
'dlrow olleh'
string = 'abcd'
''.join(reversed(string))