Answers for "factorise in python"

3

factorise expression 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
0

factorial python

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

Python Answers by Framework

Browse Popular Code Answers by Language