Concept
Naming Variables
Variable names can only use letters, numbers, and underscores `_`. Never start with a number and never include spaces.
python
user_score = 42
_secret = "hidden"
# 9. Naming Variables Variable names can only use letters, numbers, and underscores `_`. Two deadly traps: 1. Never start with a number (`1st_player` will crash). 2. Never put spaces (`my score` will explode). Standard convention is `snake_case`: all lowercase words separated by underscores (`user_score`).
Checkpoint
Which variable name will make Python throw an angry `SyntaxError`?
Practice
Write a valid variable storing the number `42` named `total_score` and print it.
01
Tap code blocks below to assemble
Available Blocks