def factorList(num):
listOfFactors = []
for i in range <= num:
if num / i == 0:
listOfFactors.append(i)
print(listOfFactors)
factorList(36)
I want the function to go through each number between 1 and the number input until it finds a factor and adds it to a list
range()is a function (it needs parens), and it starts at zero, rather than 1...You seem to have tried to combine
rangewith a while loop logic, like soBut you can do the same with list-comprehension
Output
side-note: For factorization, you only need to loop up to the square-root of the number.