How to reverse a string in Python

def my_function(x):
  return x[::-1]

mytxt = my_function("I wonder how this text looks like backwards")

print(mytxt)

After cutting the string and start moving from the end of the string.

Published 186 original articles · won praise 21 · views 10000 +

Guess you like

Origin blog.csdn.net/sinat_23971513/article/details/105280835