0
If you reassign a variable will everything you've done previously with the variable (before you changed it) change as well?
3 Réponses
+ 1
Short answer: No.
Long answer: every program executes commands as is without getting ideas of it's own, unless you tell it to get ideas of it's own. That means the previous assignments remain valid and it's assumes the later assignments by executing the following commands. (sorry for the grammar. I'm a learner myself so my normal English is getting in the way of using technical terminology)
0
Yes. Because the value of the variable will change. If at the start of the code you write "x = 2" and then later you write
"x = 4". If you now print(x). Python will return 4.
0
I feel python is like the military, obeys the last commands