python · level 1 · unit 2 · lesson 3
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
Give every box a name that tells you what is inside.
Names can use letters, digits and the underscore _. They cannot contain spaces or start with a digit. Python is case-sensitive, so Pet and pet are two different boxes.
A good name says what is inside. x could be anything, but pet_name explains itself. Future you will be grateful.
If a name needs more than one word, write it in small letters with underscores between the words, like best_friend. This style is called , because it is long and low, like a snake.
best_friend = "Priya"
print("My best friend is " + best_friend) Once you pick a name, spell it exactly the same way every time.
guess first
Will Python like this name?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
2nd_place = "Ollie"
print(2nd_place)
your turn
Your turn. Name a box yourself.
Make a box for your favourite film. Give it a snake_case name, put the film between the quotes, and use the same name at the end of line 2.
fix it
This name has a gap in it. Can you fix it?
- Python reads a space as the end of a name. Look at the name on line 1.
- Names cannot contain spaces. Which character joins words in snake_case?
- Change favourite colour to favourite_colour on both lines, then press run.
nailed it
you named your boxes like a pro. :D
- Names use letters, digits and underscores, with no spaces.
- A name cannot start with a digit.
- Use snake_case: small letters, underscores between words.
new words in your collection
- snake_case
This lesson isn’t saved. A free account remembers every lesson you finish.