fork download
  1. choice = int(input("Enter a number: "))
  2.  
  3. def fact(num):
  4. if(num == 0):
  5. return 1
  6. return num * fact(num-1)
  7.  
  8. factorial = fact(choice)
  9. print("The factorial of %d is %d." % (choice, factorial))
Success #stdin #stdout 0.02s 9356KB
stdin
5
stdout
Enter a number: The factorial of 5 is 120.