完整代码
def reverse(s):
if s== "":
return s
else:
return reverse(s[1:])+s[0]def getString():
a=input("input a string\n")
return a
if s== "":
return s
else:
return reverse(s[1:])+s[0]def getString():
a=input("input a string\n")
return a
a=getString()
b=reverse(a)
print(b)
输出结果如图所示
Comments NOTHING