Question DSA-MATH-0008
MediumWhat is the output of this code?
n = 20
is_p = [True] * n
is_p[0] = is_p[1] = False
for i in range(2, int(n ** 0.5) + 1):
if is_p[i]:
for j in range(i * i, n, i):
is_p[j] = False
print([i for i in range(n) if is_p[i]])
Tap an option to check your answer. Or practise with a timer