The inner loop of a pair of loops has an else block. The program lists numbers for which that block runs.
for n in range(2, 6):
for d in range(2, n):
if n % d == 0:
break
else:
print(n, end=" ")
print("done")
What is printed on the screen?
Log in to join the discussion.
Loading…