我正在尝试制作一个反向函数,它接受输入(文本)并输出反转版本.所以"Polar"会打印raloP.
def reverse(text):
list = []
text = str(text)
x = len(text) - 1
list.append("T" * x)
for i in text:
list.insert(x, i)
x -= 1
print "".join(list)
reverse("Something")
Run Code Online (Sandbox Code Playgroud) python ×1