Night 2: Give your pet a name
You already finished this night, in Python or pseudocode. It counts for both. Practise again if you like.
Tonight: give your pet a name
- Last night your pet woke up. Tonight it gets a name.
- You will learn one thing: variables.
Words for tonight
| Word | Meaning |
|---|---|
| variable | a box with a name; it keeps a value |
| value | what is inside the box, like "Lumi" or 7 |
| type | what kind of value the box keeps: STRING is text, INTEGER is a whole number |
A box with a name
- First make the box:
DECLARE, the name,:, then the type. - Then put a value in it with the arrow
←. It means put into the box. - You can type
<-. The editor turns it into←.
DECLARE PetName : STRING
PetName ← "Lumi"
OUTPUT PetName
OUTPUT PetNamehas no quotes. So you see what is in the box.

Quotes or no quotes?
- With quotes, you get the word itself.
- Without quotes, the computer looks for a box with that name.
DECLARE PetName : STRING
PetName ← "Lumi"
OUTPUT "PetName"
OUTPUT PetName
Output two things
- Put a comma between the things after
OUTPUT. - The comma joins them with no space. So put the space inside the quotes:
"Hello, ".
DECLARE PetName : STRING
PetName ← "Lumi"
OUTPUT "Hello, ", PetName
A new value
- You can put a new value in the same box.
- The old value is gone. The box keeps only the newest one.
DECLARE Mood : STRING
Mood ← "sleepy"
Mood ← "happy"
OUTPUT Mood
Good names
- Start with a capital letter. Join words with no space:
PetName,BestFood. - Do not start with a number.
- Use the same spelling every time you use the name.
Now you try
- Do the tasks below. Press Run, then Check answer.
- When all tasks pass, your pet knows its name.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
The box PetName is declared. Put the text "Lumi" in it with ←.
Click Run to see the output here.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
PetName holds "Lumi". Output My name is and the name on one line, so the output is My name is Lumi. Use the variable, not the word Lumi.
Click Run to see the output here.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Your pet wants a new name. Put "Nova" in PetName on the empty line. Do not change the OUTPUT line. The output should be Hi, I am Nova.
Click Run to see the output here.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Declare two STRING variables, PetName and Food. Put "Kit" in PetName and "apples" in Food. Then output Kit likes apples using both variables.
Click Run to see the output here.