Reverse A List Using Recursion | Python Example

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

This is what I came up with before watching the video :D

def reverse(arr, ans=[]):
if len(arr) == 0:
return ans
ans.append(arr.pop())
return reverse(arr, ans)


print(reverse(numbers))

juanmacias