Answers for "factorsof a no in python"

-2

to find factors of a number 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 = 6

print_factors(num)
Posted by: Guest on November-03-2020
1

python find the factors of a number

def findFactors(num: int)->list:
  factors=[]
  for i in range(1,num+1):
     if num%i==0:
         factors.append(i)
  return factors
Posted by: Guest on April-15-2021

Code answers related to "factorsof a no in python"

Python Answers by Framework

Browse Popular Code Answers by Language