Python reversing a string using recursion

前端 未结 6 627
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 23:34

I want to use recursion to reverse a string in python so it displays the characters backwards (i.e \"Hello\" will become \"olleh\"/\"o l l e h\".

I wrote one that do

6条回答
  •  佛祖请我去吃肉
    2020-12-15 00:06

    If this isn't just a homework question and you're actually trying to reverse a string for some greater goal, just do s[::-1].

提交回复
热议问题