Question DSA-MATH-0044
MediumWhat is the output of this code?
def factors(n):
f, d = [], 2
while d * d <= n:
while n % d == 0:
f.append(d); n //= d
d += 1
if n > 1:
f.append(n)
return f
print(factors(360), factors(97))
- A.
[2, 2, 2, 3, 3, 5] [97]
- B.
[8, 9, 5] [97]
- C.
Sign up free to see the answer and a step-by-step explanation.