Answers for "factor a number python"

5

factorial in python

def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)
n=int(input("Input a number to compute the factiorial : "))
print(factorial(n))
Posted by: Guest on November-23-2020
5

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

factorial in python

# Python code to demonstrate naive method
# to compute factorial
n = 23
fact = 1
  
for i in range(1,n+1):
    fact = fact * i
      
print ("The factorial of 23 is : ",end="")
print (fact)
Posted by: Guest on November-05-2021
0

factorial python

def factorial(n)
    if n < 2:
        return 1
    else:
        return n * factorial(n - 1)
Posted by: Guest on October-23-2021

Code answers related to "factor a number python"

Python Answers by Framework

Browse Popular Code Answers by Language