The question (please ignore #4)

This is my code, i need it to print 3, 7, and 19 i believe
i = 2
count = 0
print("Every 3rd sequential odd numbers between 2 and 19(inclusive):")
while i <= 19:
if i%2 != 0:
count = 1
if count%3 == 0:
print(i)
i = 1
CodePudding user response:
i = 2
count = 0
print("Every 3rd sequential odd numbers between 2 and 19(inclusive):")
while i <= 19:
if i%2 != 0:
count = 1
if count%3 == 0:
print(i)
i = 1
- i = 1 should be outside the if statement.
- Second if should be inside the first if.
CodePudding user response:
I believe that's the solution for your problem, it prints out 7, 13 and 19 - every 3rd sequential odd numbers between 2 and 19:
i = 2
count = 0
print("Every 3rd sequential odd numbers between 2 and 19(inclusive):")
while i <= 19:
if i%2 != 0:
count = 1
if count == 3:
print(i)
count=0
i = 1
