Code Monsters Academy
Home › Course contents › Level 6: Name Tag
Variables

Level 6: Name Tag

Chapter 1 · Starter Village

To make the computer remember something, hang a name tag on it:

name = "{PET}"     # make a name tag called name that holds "{PET}"
print(name)        # say what's inside the name tag

Notice that name on the second line has no quotes: with quotes it would just say the four letters "name"; without quotes it looks inside the name tag.

Programmers call a name tag like this a variable.

GoalChange the name in the name tag to a new name of your choice, and have your partner say it.
TipThe equals sign = means "put the thing on the right into the name tag on the left".
Starting code
# Line 1: make a name tag called name and put your new name in it (with quotes)

# Line 2: have your partner say the name in the tag (no quotes around name)
Practise this in the game
← Previous levelLevel 5: The secret of quotesNext level →Level 7: Snack Time