小编Eri*_*eus的帖子

用于反转文本字符的功能

我正在尝试制作一个反向函数,它接受输入(文本)并输出反转版本.所以"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

2
推荐指数
1
解决办法
641
查看次数

标签 统计

python ×1