"Look at my score box!" Rocket says. It sits on his desk. Right now it holds zero.
Rocket scores a goal. The box now holds one. Then two. Then three.
"What do you notice?" Raven asks. "The name stays the same. The value changes."
Nova glows. "That box is a variable," she says. Let's name a box and give it a value.
ROCKET keeps a box on the desk labeled SCORE. Right now it holds the number 0. When Rocket scores a goal, the box changes to 1. Then 2. Then 3. The box has the SAME NAME but a DIFFERENT VALUE. That box is a VARIABLE.
Pick a name for a box. Pick a starting value.
Every variable has two parts. The NAME is the label on the box. The VALUE is what is inside.
When the value changes, the old value is gone. The box holds one value at a time.
lives = 3 lives = 2 print(lives)
| Statement | True or false? |
|---|---|
| A variable has a name and a value. | ? |
| The name changes when the value changes. | ? |
| A new value replaces the old value. | ? |
| color = blue puts the value blue in the box named color. | ? |
| A variable can hold two values at the same time. | ? |