Factorial calculation in python

960 viewsPython

Factorial calculation in python

Have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it. For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24. For the test cases, the range will be between 1 and 18 and the input will always be an integer.

Farjanul Nayem Answered question July 22, 2022
0

def FirstFactorial(num):
  factorial = 1
  for i in range (1,int(num)+1):
   factorial = factorial * i
  return factorial
 # keep this function call here 
print(FirstFactorial(input()))

Farjanul Nayem Answered question July 22, 2022
0