def reverse_list(li): if len(li) == 0: return li last, init = li[-1], li[:-1] return [last, *reverse_list(init)] li = [1,2,3] print(li) print(reverse_list(li))
To embed this project on your website, copy the following code and paste it into your website's HTML: