So, I have a simple piece of code that outputs integers 1-10:
i = 0
while i < 10:
i += 1
print(i)
Then, if you just change one statement to line 3, it produces an infinite number of 1 integers (which I understand why it does this). Why is there no syntax error when starting this second program? Wouldn't that cause a syntax error if the assignment operator is followed by the addition operator?
i = 0
while i < 10:
i =+ 1
print(i)
source
share