REMEMBER PYTHON

MINTE9
2REMEMBER




Reassignment

p120 ! In Python it is legal to reassign a variable. Also, an assignmet can make two variables equal, but not permanent.
 
>>> x = 5
>>> x
5
>>> x = 7
>>> x
7

>>> a = 1
>>> b = 1
>>> a = 2
>>> b
1
... 11 lines
˄˄˄
If you try to update a variable that doesn't exist, you get an error.
 
>>> y = y + 1
NameError: name 'y' is not defined
... 2 lines
˄˄˄

Questions    
No. 13   While
CARD
12
32

        A B C D E F
🔔
1/1