Jed Rembold & Fred Agbo
February 5, 2024
The Kilburn’s algorithm for finding the factor of a number using brute-force strategy is shown on the right. What would be the printed output of the code?
def largest_factor(n):
factor = n - 1
while n % factor != 0:
factor -= 1
return factor
if __name__ == '__main__':
fac = largest_factor(20)
print(fac)
==
for
numeric comparisons! Rounding might result in unexpected falsehoods
0.1 + 0.1 + 0.1 != 0.3