In this example we will show how to reverse a string using functions in Python.
Source Code
def my_function(x):
return x[::-1]
my_string = 'I love Python'
my_string_reverse = my_function(my_string)
print(my_string_reverse)
Output:
nohtyP evol I