Factorial (Recursive) medium
functions

Write a recursive function solution(n) that returns n! (n factorial).

  • 0! = 1
  • n! = n × (n-1)!

Example

solution(5) → 120
solution(0) → 1
solution(7) → 5040
solution.py
💡 Tip: Press Ctrl+Enter to run