The dragon explains
Numbers, not just words
The dragon: So far you've only given me words in quotes. But I can say numbers too — and those work differently.
The dragon: A number needs no quotes at all. Just put it straight in.
example.pyPython 3print(42)Output42The dragon: And here's the interesting part: without quotes, Python works things OUT before I say them.
example.pyPython 3print(2 + 3)Output5The dragon: I didn't say '2 + 3'. Python did the sum first, then handed me the answer.
example.pyPython 3print(2 + 3)The dragon: Now watch what quotes do to the exact same thing.
example.pyPython 3print("2 + 3")Output2 + 3The dragon: With quotes it's just symbols to read out. Without them it's a sum to solve. Same characters, completely different meaning.
example.pyPython 3print("2 + 3")print(2 + 3)
Output2 + 3 5
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
What will I say here?
question.pyPython 3print(10 + 5)- 15Correct
- 10 + 5
- Nothing — numbers need quotes like words do
Why: Python does the maths before I speak, so I say 15. The sum happens first, then I say the result.
Question 2 of 2
And what about this one?
question.pyPython 3print("10 + 5")- 10 + 5Correct
- 15
- "10 + 5" — with the quote marks
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.
In the game
What you'll practice
Four levels in the game: one guided first try with the shape of the answer already there, then three to solve on your own.
- 1
GuidedYour first try
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.
- +3
PracticeThree more, on your own
Try it yourself — in real Python.
This lesson is part of a free topic: every lesson in it is free, and no card is needed.
Start this lesson for realStuck three times? The game offers the answer — unasked.