Answers for "python methods for a factorial"

3

how to factorise expressions in python

# Python Program to find the factors of a number

# This function computes the factor of the argument passed
def print_factors(x):
   print("The factors of",x,"are:")
   for i in range(1, x + 1):
       if x % i == 0:
           print(i)

num = float(input())

print_factors(num)
Posted by: Guest on April-23-2022
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

Code answers related to "python methods for a factorial"

Python Answers by Framework

Browse Popular Code Answers by Language