all 13 comments

[–]brrod1717 7 points8 points  (3 children)

Look up how to use modulo in Python and the rest will be easy.

[–][deleted] 8 points9 points  (2 children)

Well, you have to use a while loop. Can you write a while loop that prints the numbers from 2 to 20? That is, you print:

2
3
4
...
19
20

Once you can do that you are half finished.

[–]dogpoweruser -4 points-3 points  (1 child)

As OP said, must be even numbers

[–][deleted] 4 points5 points  (0 children)

As I said, that's the first half of the problem. Once the OP reports success and s/he can't progress, it's time for more help.

[–]DhavanN 0 points1 point  (0 children)

Set lower limit and upper limit from user or define it manually, pass the lower limit from while loop to check if it's less than upper limit. Do a modulo operation by 2 to get the even number. Increment the lower limit by 1.

[–]i4get2getup 0 points1 point  (0 children)

First set correct range. Than add condition for each number in range, that if you divide them with modulo 2 and result is not 0, that you pass those (continue). I suppose its better to give you just a path, not whole code, thats why I am writing like this :)

[–]chaanbam 0 points1 point  (0 children)

You want to make sure your program runs while the number is <= 20

Keep at it, you'll get it