PROGRAMMING

  minte9
MEMORYApp




S R Q
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Assign

A variable must be assigned before use.
 
"""A variable must be assign before use
"""

y = 0
y = y + 1
assert y == 1 # pass

try:
    z = z + 1
except NameError:
    print('Variable z not defined')

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 # pass
assert x != 5 # pass

a = 1
b = 1

assert a == b # pass

a = 2

assert a != b # pass

Questions    
Last update: 16 days ago
Approximate