def reverse(li):
if len(li) == 0:
return []
x, *xs = li
acc = reverse(xs)
return [*acc, x]
def reverse2(li):
match li:
case []:
return []
case [x, *xs]:
acc = reverse(xs)
return [*acc,x]
print(reverse2([1,2,3]))
To embed this project on your website, copy the following code and paste it into your website's HTML: