PROGRAMMING

 
REMEMBERS




Assign

A variable must be assigned before use.
 
# Variable assignement ...
#
# A variable must be assign before use

y = 0
y = y + 1

assert y == 1

# z = z + 1
#    # NameError: name 'z' is not defined
... 3 lines
 

Reassignment

p120 ! In Python it is legal to reassign a variable.
 
# In Python it is legal to reassign a variable.
# An assignment can make two variables equal, but not permanent.

x = 5
x = 7

assert x == 7
assert x != 5

a = 1
b = 1

assert a == b

a = 2

assert a != b

... 5 lines
 

Questions     github Functions
Approximate

        A B C D E F
🔔
1/1