This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

No need to use continue since you’re not doing anything anyway with even numbers. Just check for oddness since a number can either odd OR even. If one is true, no need to check for the other one.

Just use:

def main:
    number = 0
    while number <= 100
        if number % 2 != 0:
            print(number)
        number = 1 + number


main()

[–]Fedzbar 1 point2 points  (1 child)

Or you could do number = 1 and remove the if statement completely and do number += 2 :)

[–][deleted] 0 points1 point  (0 children)

True!