4 ms·
The indentation is broken, so one possible way to interpret it is: def is_prime(n: int): result = True for k in range(2, int(n ** 0.5) + 1):
by cyphar 4y ago
The indentation is broken, so one possible way to interpret it is:
def is_prime(n: int):
result = True
for k in range(2, int(n ** 0.5) + 1):
if n % k == 0:
result = False
break
return result
Which is just a more complicated (n % 2 != 0). Obviously the break should be in the if block.
- deleted 4y ago[deleted]