Answers for "defione a fucntion in python to return a reverse order of a given string"

28

reverse string in python

'hello world'[::-1]
'dlrow olleh'
Posted by: Guest on December-06-2019
-1

Python reverse a string

# Library
def solution(str):
    return ''.join(reversed(str)) 
  
# DIY with recursion
def solution(str): 
    if len(str) == 0: 
        return str
    else: 
        return solution(str[1:]) + str[0]
Posted by: Guest on March-02-2021

Code answers related to "defione a fucntion in python to return a reverse order of a given string"

Python Answers by Framework

Browse Popular Code Answers by Language