I just need to know why the code generated numbers that are not divisible by 5.
for x in range (10,20):
#if (x == 15): break
if (x % 5 == 0) : continue
print(x)
Is my understanding correct, that x % 5 == 0
means all x
values that have a remainder of 0
when divided by 5
? So would it mean that the code should generate all values that are divisible by 5
?
continue
means "stop the current iteration and start the next one". when you find a number divisible by 5, you do not print it. – DYZ Jul 1 '20 at 4:05x % 5 == 0
is correct, but you should be printing thosex
instead ofcontinue
-ing. – Gino Mempin Jul 1 '20 at 4:16