# Python Challenge 1

 Robert Summers · September 13, 2014 So I was just watching Bucky's 10th Python Programming Tutorial and have attempted to try Bucky's Challenge. I could not work this one out. He asked for a loop to 100 and print out every multiple of 4. I'm stuck, this is the only bit I have worked out.Help and answers would be greatly appreciated. ``x = 0for x in range(100):    if (x % 4):{        print(x)    }``Thank you.

## Replies

 Nathanael Potter · September 13, 2014 You need to say that if x is 0 (After doing x%4) then print x``for x in range (101): if x%4 is 0: print(x)`` Ethan Hann · September 20, 2014 You could also use an if-else-continue statement ``#This program will print out the multiples of 4 from 0 to 100for n in range(101):    if n % 4 == 0:        print(n)    else:        continue`` Ethan Hann · October 14, 2014 I know they do the same thing, however it may be easier to read if you write it with a continue statement. For each number in the range it will test if that number is divisible by 4: if it is print it out on the screen; if it isn't continue to the next number in the range. It just makes the code a little easier to understand IMO. Brock Cryoston · October 15, 2014 This is the most compact way of doing it, producing the same result with a different method.It just basically counts up by the increments of 4. Robert Summers · September 17, 2014 Thanks for the help dude Nate Penner · October 4, 2014 The else: continue doesn't serve any purpose, the loop will continue anyways Nate Penner · October 4, 2014 ``for x in range(1, 101):    if x % 4 is 0:        print(x)``
• 1

## Python

128,224 followers