The following code will print the prime numbers between 1 and 100. Modify the code so it prints every other prime number from 1 to 100
In [2]:
n = 0
for num in range(1,101): #range(1,101):from 1 to 101 not including 101
prime = True # prime is a variable that contains boolean value/true or false, boolean flag to check the number for being prime
for i in range(2,num): #range(2,num): from 2 to num not including 101
if (num%i==0):
prime = False
if prime:
n=n+1
if (n%2==0):
print(num)
In [ ]: