fork download
  1. def inverter(lista):
  2. if len(lista) <= 1: # lista vazia ou com um elemento, retorna ela mesma
  3. return lista
  4. return lista[-1:] + inverter(lista[:-1])
  5.  
  6. # inverter lista com 3000 números
  7. lista = inverter(list(range(3000)))
  8.  
Runtime error #stdin #stdout #stderr 0.17s 43836KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
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 995 more times]
  File "./prog.py", line 2, in inverter
RecursionError: maximum recursion depth exceeded while calling a Python object