+ 1
You're given a program that outputs all the numbers from 0 to 10. Change the code to make it output only the even numbers.
HELP!! My mind is all over the place
5 Answers
+ 3
An even number is the one which when divided by 2 gives a remainder 0.
+ 3
pain fr ,
can you please post your code, so that we can see where the issue is?
thanks!
0
Brian I get that but how can I make it so that only the even numbers print and not the odd numbers
- 1
Look at the example given in Python Lesson 23.1. Consider how you could modify it to do what you want.
Here is the code:
x = 1
while x < 10:
if x%2 == 0:
print(str(x) + " is even")
else:
print(str(x) + " is odd")
x += 1