The initial value of current_line
is 1
. When you call, current_line = current_line + 1
, we first evaluate what’s on the right hand side of the =
. That is current_line + 1
, which gives 2
. Now 2
gets assigned to the variable on the left of =
, which is current_line
. So now current_line
is 2
! The old value of current_line
(1
) gets overwritten.
0
solved learn python the hard way exercise 20 i dont understans how it increments the line numbers 1, 2, 3 [closed]