Guys what's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys what's wrong with my code?

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

24th Aug 2021, 5:57 PM
reihane
reihane - avatar
2 Answers
+ 3
Space x += 1 should be outside of if- statement if x % 2==0: print(x) x += 1
24th Aug 2021, 6:14 PM
Pariket Thakur
Pariket Thakur - avatar
+ 7
x = 0 while x <= 10: if x % 2==0: print(x) x += 1
24th Aug 2021, 6:11 PM
JaScript
JaScript - avatar