EXERCISE

0 irfan ibrahimbegović · February 18, 2015
IS TIHS O.K. FOR SOLUTION OF YOUR EXERCISE , AT THE END OF VIDEO :D



for x in range(1,101):
      d=x%4
       t=d
       if t==0:
           print(x)

Post a Reply

Replies

Oldest  Newest  Rating
0 Jean DeZonia · February 18, 2015
This is what I did.

for n in range(1, 101):
       if n % 4 == 0:
            print(n)
0 irfan ibrahimbegović · February 19, 2015
nice it's a little bit simple than my , I like it :) ... sory if my english isn't grammaticly corect. I'm from Bosnia and Herzegovina hehehehhehe
0 voicu stefan · February 20, 2015
for n in range(1, 101):
if n%4 <= 0:
print(n, "this is divisible by 4")


#This is how i mannaged to think it.
0 Zac Smith · February 20, 2015
Here was my attempt:

for x in range(101):
if x%4 is 0:
print(x, 'this number is divisible by 4!')
0 Zac Smith · February 20, 2015
voicu stefan ...

I don't understand why you used n%4 <= 0:, instead of == or 'is'?
0 voicu stefan · February 22, 2015
My mistake.
I should use " == "
0 Zac Smith · February 23, 2015
Voicu stefan ... Thanks for the clarification! 
  • 1

Python

107,232 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator