CurriculumPython print() for KidsNumbers, not just words
Why print("2 + 2") Doesn't Print 4 in Python
Printing values Python works out — and why quotes change everything.
Numbers, not just words
So far you've only given me words in quotes. But I can say numbers too — and those work differently.
A number needs no quotes at all. Just put it straight in.
print(42)Output
42And here's the interesting part: without quotes, Python works things OUT before I say them.
print(2 + 3)Output
5I didn't say '2 + 3'. Python did the sum first, then handed me the answer.
print(2 + 3)Now watch what quotes do to the exact same thing.
print("2 + 3")Output
2 + 3With quotes it's just symbols to read out. Without them it's a sum to solve. Same characters, completely different meaning.
print("2 + 3")
print(2 + 3)Output
2 + 3
5Check your understanding
What will I say here?
print(10 + 5)Why: Python does the maths before I speak, so I say 15. The sum happens first, then I say the result.
And what about this one?
print("10 + 5")Why: With quotes it's text, so I read it exactly: 10 + 5. Compare that to print(10 + 5) with no quotes, which gives 15. The quotes are the whole difference.
What you'll practice
The dragon is counting its hoard and wants to say the number out loud. Numbers do not need quotes — print them exactly as they are.
More from this topic
Numbers, not just words is one lesson inside Python print() for Kids — see the full lesson order and what the whole topic covers.
View the full topic →