# Python Program to Find Factors of a Number

In this example, we will write a user-defined function that prints the factors of a number. Factors of a number are those number that divides the number without any remainder. To better understand this example, make sure you have knowledge of the following tutorials:-

## Python Program to Find Factors of a Number

def print_factors(x):
print("The factors of", x, "are:")
for i in range(1, x + 1):
if x % i == 0:
print(i)

num = int(input("Enter a number: "))
print_factors(num)

The output of the above program is:-

Enter a number: 430
The factors of 430 are:
1
2
5
10
43
86
215
430
Program Explanation:-
In this program, user input is taken using input() function and passed to a function print_factors() which takes one argument, num as input. The for loop is used to iterate from 1 to num+1 which checks for the condition where the number is exactly divided or not. If the number is exactly divided, then, the output is printed.