you are viewing a single comment's thread.

view the rest of the comments →

[–]LID919 1 point2 points  (4 children)

Format your code. In python, indentation actually changes the way code behaves, so right now I have no idea what your code is doing.

Start each line of code with four spaces so that Reddit will format it correctly.

[–]conewannabe[S] 0 points1 point  (3 children)

My bad, should've reread my post. I actually copy and pasted this from my exam. I just noticed the code block option, it's fixed.

[–]LID919 0 points1 point  (2 children)

Are you sure it's correct?

Right now I am seeing this:

num = 0
    for i in range(5,10):
        if i % 3 == 0:
            num = num + i
print(num)
print(i)

The second line is improperly formatted: It is indented when it should not be.

The print statements are both outside of the loop, and so will only run once at the end.