1# Python Program to find the factors of a number
2
3# This function computes the factor of the argument passed
4def print_factors(x):
5 print("The factors of",x,"are:")
6 for i in range(1, x + 1):
7 if x % i == 0:
8 print(i)
9
10num = 6
11
12print_factors(num)
13
1def findFactors(num: int)->list:
2 factors=[]
3 for i in range(1,num+1):
4 if num%i==0:
5 factors.append(i)
6 return factors
1def factors(n):
2 return set(reduce(list.__add__, \
3 ([i, n//i] for i in range(1, int(n**0.5) + 1) if not n % i )))