Write a Python function called reverse_string
that takes a string as an input and returns the string reversed.
OminduAnjanaJunior Developer
Write a Python function called reverse_string that takes a string as an input and returns the string reversed.
Share
To write a Python function called `reverse_string` that takes a string as input and returns the reversed string, you can use the following code:
def reverse_string(input_string):
return input_string[::-1]
This function uses Python slicing to reverse the input string. You can test this function by passing a string as an argument to it.