To print prime numbers between 1 and 20 I used the following code. While I understand the output was wrong because of the indentation, but I specifically want to understand what is happening here. Can please someone help me? Here is my code:
for n in range(1,20):
flag = True
for i in range(2,n):
if n % i == 0:
flag = False
break
if flag :
print (n)
Aucun commentaire:
Enregistrer un commentaire