Beginner here, whenever I try to run the code with sum as 20 for example, it only returns [2,10], rather than the intended [2,10,4,5,5,4,10,2]
def Factors(num):
factor1=2
factors=[]
while factor1<num:
while num%factor1 == 0:
factors.append(factor1)
factors.append(num/factor1)
factor1+=1
continue
if num%factor1 != 0:
factor1+=1
return factors