0

What does x += 1 this line do? I get same output even if I don't write this line

https://code.sololearn.com/cee2LHejqrH0/?ref=app

18th Aug 2021, 2:17 PM
Tanvir Ahmed
Tanvir Ahmed - avatar
4 odpowiedzi
+ 3
Increments value by 1 . And i don't see why it should affect the output in anyway. Maybe you want to put it inside while loop with same indentation as if else block
18th Aug 2021, 2:27 PM
Abhay
Abhay - avatar
+ 2
X+=1 means x=x+1
18th Aug 2021, 2:27 PM
Atul [Inactive]
0
x = 1 while x < 10: if x%2 == 0: print(str(x) + "is even") else: print(str(x) + "is odd") x += 1 #hope this helps you
18th Aug 2021, 2:28 PM
Atul [Inactive]