Python Challenge #1 
+1 
Brock Cryoston
· October 15, 2014
2 lines, I think this is the most compact way of doing the challenge. In Bucky's tutorial #9 he mentioned that if you add a 3rd number in the parentheses it will count in increments of 4. 
Post a Reply 
Replies 
Oldest Newest Rating 
0 
Abom in81on
· November 13, 2014
I used
for n in range(1,101): if n % 4 is 0: print(n) which I think meets all the criteria set out in the challenge and works correctly in the most efficient way. I'd like to see if anyone has a better way to do this. And thanks for the challenge Bucky, it's a good check to make sure I'm picking this up. edit* The white space hasn't copied correctly so the indentation is a little off. 
0 
Vaibhav Patel
· November 11, 2014
16:37:31
for n in range(0, 26): if n is 0: print(n) else: print(n*4) 
0 
Vaibhav Patel
· November 11, 2014
Another way to get the result.
Bucky, Please have you say on all the above comments as well. I have come up with 3 different way to get the result, but not sure if any of them is correct way. for n in range(1, 26): if n > 0: print(n*4) Can't think any more... 
0 
Vaibhav Patel
· November 11, 2014
magicNumber = 0 for n in range(26): if n is magicNumber: print(n) break else: print(n*4) 
0 
Daniel Bogorad
· October 31, 2014
hy ,
and yet another way, no real difference though ... 
0 
Jose Peregrina
· October 21, 2014
Brock, your approach it is really nice despite you do not use x%4. It can be done as follows:
You will get from 4 to 100. 
0 
Brock Cryoston
· October 20, 2014
Oh I didn't catch that part darn! Thanks

+1 
Windy Boja
· October 19, 2014
Hi The problem is that the way u did it, it means that the result starts from 0 and Buckys asked to choose numbers from 1 to 100. If u put 1 the point where tha program should start, it still will not work correctly because it will be incremented by 4 so u will have numbers 5 and so on (5, 9 etc..) I did it this way and it seems to work ok

 1