The dragon explains
Naming as a thinking tool
The dragon: Every level so far, names like x, y, and z would have worked just as well as health or gold. Let's see that directly.
The dragon: x, y, z — terrible names, but watch the output.
example.pyPython 3x = 100y = 30z = x - yprint(z)
Output70The dragon: Same exact math, real names this time. Same output.
example.pyPython 3health = 100damage = 30remaining_health = health - damageprint(remaining_health)
Output70The dragon: Python genuinely does not care what anything is called — it ran the SAME subtraction both times and got the SAME 70.
The dragon: So what does a name actually change? Whether a human — you, in six months, or someone reading your code — can tell what it's FOR without re-figuring it out.
The dragon: A good name answers 'what is this' at a glance. remaining_health tells you immediately; z tells you nothing at all.
Quick check
Check your understanding
Say your answer out loud before reading the marked one. Every wrong option is a mistake real beginners make.
Question 1 of 2
x = 100, y = 30, z = x - y vs. health = 100, damage = 30, remaining_health = health - damage. Do these two programs behave differently when run?
question.pyPython 3x = 100y = 30z = x - yprint(z)
- No — they compute the exact same thing and print the exact same numberCorrect
- Yes — the version with real names is more accurate, since Python understands what health means
Why: No difference at all — both compute 100 - 30 and print 70. Python has no concept of what a name 'means' in English; it just needs SOME label to refer to a value by. The only thing that changes with better names is how easily a human can follow the code.
Question 2 of 2
If naming never changes what a program actually DOES, why does it matter at all?
- Because a human reading the code later has to understand it — and a good name does that work for themCorrect
- It doesn't really matter — since Python doesn't care, naming is just decoration
Why: Because code is read by humans far more often than it's run by a computer's concern for correctness. z = x - y and remaining_health = health - damage run identically, but only one of them tells a reader what's actually happening without extra work — that's the entire value of a good name.
In the game
What you'll practice
Three levels in the game: one guided first try with the shape of the answer already there, then two to solve on your own.
- 1
GuidedYour first try
Run this code exactly as it is. x, y, and z are terrible names — but predict the OUTPUT anyway. Does bad naming change what the code actually computes?
- +2
PracticeTwo more, on your own
This lesson is part of PRO.
PRO is a one-time $49.99 purchase, no subscription, and unlocks this whole topic along with everything else. Topics 1–3 are free, start to finish.
Unlock this lesson with PROStuck three times? The game offers the answer — unasked.