0

# Please who knows how to print even numbers in python using while loop

Python Coding

7 Answers

+ 3

You can use modulo division operator for check if a number is even. Try to do that in an attempt on Sololearn Playground and link with your question.

+ 3

#Even numbers from 0 to 100
i = 0
while i<=100:
print(i)
i += 2

+ 1

First, you'll have to see how till how many you want to print. So for eg. Even numbers till 10 will be like this
i = 1
# Run a loop 10 times
while i <= 10:
# Check if i is an even number. if yes, then print it
if i % 2 == 0:
print(i)
i += 1

+ 1

Thank you

0

i = 0
while i <= 100:
print(i := i +2)

0

Or,
i = 0
while i <= 100:
print(i := i +2)

- 2

You can use modulo division operator for check if a number is even. Try to do that in an attempt on Sololearn Playground and link with your question.

Hot today

I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.

1 Votes

Тренажер кода

0 Votes

Python palindrome challenge.

1 Votes

Java

0 Votes