def inverter(lista): if not lista: # lista vazia, retorna ela mesma return lista return lista[-1:] + inverter(lista[:-1]) # inverter lista com 3000 números lista = inverter(list(range(3000)))
Standard input is empty
Standard output is empty
Traceback (most recent call last): File "./prog.py", line 7, in <module> File "./prog.py", line 4, in inverter File "./prog.py", line 4, in inverter File "./prog.py", line 4, in inverter [Previous line repeated 996 more times] RecursionError: maximum recursion depth exceeded