Guys what's wrong with my code? | Sololearn: Learn to code for FREE!

+1

Guys what's wrong with my code?

x = 0 while x <= 10: if x % 2==0: print(x) x += 1

8/24/2021 5:57:58 PM

reihane

3 Answers

New Answer

+3

Space x += 1 should be outside of if- statement if x % 2==0: print(x) x += 1

+10

the counter x += 1 should be positioned outside of the if-section.

+7

x = 0 while x <= 10: if x % 2==0: print(x) x += 1