1def factors(x):
2 listOfFactors = []
3 for i in range(1, int(x ** 0.5)):
4 # Use a loop from 1 to the square root of x for more speed.
5 if x % i == 0:
6 listOfFactors.append(x)
7 listOfFactors.append(i)
8 # May repeat some numbers. Further code would be needed to fix that.
9 print(i)