fork download
  1. # your code goes here
  2.  
  3. def fact1(n):
  4. if n == 1:
  5. return 1
  6. return n * fact1(n - 1)
  7.  
  8.  
  9. def fact2(n):
  10. ret = 1
  11. for i in range(2, n + 1):
  12. ret *= i
  13. return ret
  14.  
  15.  
  16. print(fact1(10))
  17. print(fact2(10))
  18.  
Success #stdin #stdout 0.02s 9220KB
stdin
Standard input is empty
stdout
3628800
3628800