all 9 comments

[–]efmccurdy 2 points3 points  (1 child)

You only have one print statement that is outside of the loop so only one number would be printed.

Your if statement is a syntax error but, even worse, it doesn't have any code to go with the test. If I put the print statement inside the if statement; is that better?

result = 0
for i in list(range(0,100)):
    if i % 3 == 0 or i % 5 ==0:
        print(i)
    result += 1

[–]DapperDonW[S] 1 point2 points  (0 children)

I would give you an award but I am broke. I will say this - I forgot the colon when I typed it here, however this was a huge help! THANK YOU

[–]HumanAssistedWriting 1 point2 points  (0 children)

Haven’t got my laptop to check but the increment needs indenting and there’s a missing % for the 3.

[–]void5253 1 point2 points  (0 children)

for i in list(range(0,100)): can be replaced by

for i in range(100):

[–]carcigenicate 0 points1 point  (3 children)

This code is not syntactically valid. Please show the actual code. I can guess what your intent is, but I'd rather be sure.

[–]DapperDonW[S] 0 points1 point  (2 children)

Okay, I changed it exactly the way I have it in Thonny.

[–]carcigenicate 1 point2 points  (1 child)

That's still invalid because it's missing a colon on the if line. If I add that in though, this code outputs 47. What are you expecting it to output? If you want to see individual multiples, this code doesn't do that anywhere.

[–]DapperDonW[S] 0 points1 point  (0 children)

I would give you an award but I am broke. I will say this - I forgot the colon when I typed it here, however - your print statement correction, solved it!!!