def reverse(text): final_string = "" count = len(text) while count > 0: final_string += text[len(text)-1] text = text[0:len(text)-1] count -= 1 return final_string这是代码片段。我知道它会反转字符串“ text”,但似乎无法理解它是如何做到的。
添加回答
举报
0/150
提交
取消