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.
Сложность 1/5 · 100 монет + небольшой бонус за первое завершение сегодня
The box PetName is declared. Put the text "Lumi" in it with ←.
Нажмите Запустить, чтобы увидеть результат здесь.
Сложность 1/5 · 100 монет + небольшой бонус за первое завершение сегодня
PetName удерживает "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.
Нажмите Запустить, чтобы увидеть результат здесь.
Сложность 2/5 · 140 монет + небольшой бонус за первое завершение сегодня
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.
Нажмите Запустить, чтобы увидеть результат здесь.
Сложность 2/5 · 140 монет + небольшой бонус за первое завершение сегодня
Declare two STRING variables, PetName и Food. Put "Kit" in PetName и "apples" in Food. Then output Kit likes apples using оба варианта variables.
Нажмите Запустить, чтобы увидеть результат здесь.