Answers for "python built in factorial"

3

factorial in python

def fact(n):
  return 1 if (n==0 or n==1) else n*fact(n-1)
fact(3)
Posted by: Guest on August-07-2020
0

python factorial

def factorial(n):
    fact = 1
    for num in range(2, n + 1):
        fact *= num
    return fact
Posted by: Guest on December-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language