Post

@PythonPr Answer: 18
The 90% beginners trap: x += x + 4 isn't x += 9!
› x = 7 (after +2)
› x += x + 4 means x = x + (x + 4)
› x = 7 + 7 + 4 = 18
For beginners: += expands first, then evaluates both sides with the current x.
English

@PythonPr Thanks! This is reinforced learning! I just became more confident into python even though I got this wrong.
English

@PythonPr x = 5
y = x → y = 5
x = x + 2 → x = 7
x += x + 4 → x = 7 + (7 + 4) = 18
Español















