Fixed bug in fix of getDivisors two number bug

This commit is contained in:
2019-03-22 18:25:40 -04:00
parent 0e19945c84
commit 97e6d1477a

View File

@@ -143,14 +143,11 @@ def getDivisors(goalNumber: int) -> list:
#If the number is 1 return just itself
elif(goalNumber == 1):
divisors.append(1)
#Otherwise add 1 and itself to the list
else:
divisors.append(1)
divisors.append(goalNumber)
return divisors
#Start at 3 and loop through all numbers < (goalNumber / 2 ) looking for a number that divides it evenly
topPossibleDivisor = math.ceil(math.sqrt(goalNumber))
possibleDivisor = 2
possibleDivisor = 1
while(possibleDivisor <= topPossibleDivisor):
#If you find one add it and the number it creates to the list
if((goalNumber % possibleDivisor) == 0):