A Box With a Name
Computing · Page 1 of 2
Name
Date
DIRECTIONS: Work out this Python with a pencil. Fill in what
score holds after each line, then what it prints.
A variable is a named box. It holds one thing; putting in something new throws the old one away.
1score = 0
2score = 7
3score = 2
4print(score)
what it prints
Where is the 7 after line 3?
Two Boxes
Computing · Page 2 of 2
DIRECTIONS: Two boxes. Fill in what each holds after every line.
1a = 3
2b = 5
3a = b
4print(a)
5print(b)
what it prints
- After line 3, what is in b? Did line 3 change it?
- Line 3 is a = b. Explain in one sentence which box got changed and which did not.
- The 3 that was in a at line 1 — where is it after line 3? Answer carefully.