+ 1

Quotient

Hey guys, I crave an answer to my question. The question is: Why does this code says "invalid syntax": x=0 while x<=10: if x%2=0: print(x) x+=1 And this one works all fine: x=0 while x<=10: if x%2<=0: print(x) x+=1

1st Mar 2021, 4:53 PM
Alexander Istomin
Alexander Istomin - avatar
2 Respostas
+ 2
because the error is in the if statement it shoud have == instead of =
1st Mar 2021, 4:56 PM
Kavya
Kavya - avatar
0
Thx very much, I got so puzzled by that, I feel stupid now haha
1st Mar 2021, 4:58 PM
Alexander Istomin
Alexander Istomin - avatar