To find factors of any number in python, you have to ask from user to enter a number to find and print all the factors of that number on the output screen as shown in the program given here.
Following python program ask from user to enter a number to find factors of that number:
# Python Program - Find Factors of Number while True: print("Enter 'x' for exit.") num = input("Enter a number: ") if num == 'x': break else: number = int(num) for i in range(2, number-1): if number%i == 0: print(i) i += 1
Here is the sample run of the above Python program shows how to find factors of any number: