The dragon explains
What print() actually does
The dragon: You just made me speak! Let me show you what actually happened there.
The dragon: print is a command. You give it something, and it says it out loud.
example.pyPython 3print("Wake up, dragon!")OutputWake up, dragon!The dragon: The brackets are how you hand something to print. Nothing gets said without them.
example.pyPython 3print("Wake up, dragon!")The dragon: The quotes matter too. They mean 'these are words, exactly as written' — so I say them exactly as written.
example.pyPython 3print("Hello")OutputHelloThe dragon: And every print() gets its own line. Two prints, two lines. Always.
example.pyPython 3print("First")print("Second")
OutputFirst Second
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
How many lines will I say here?
question.pyPython 3print("Left")print("Right")print("Middle")
- Three linesCorrect
- One line, with all the words on it
- Two lines — the last one repeats
Why: Three prints, three lines, in the order you wrote them: Left, then Right, then Middle. I go top to bottom, always.
Question 2 of 2
What will I say here?
question.pyPython 3print("dragon")- dragonCorrect
- "dragon" — with the quotes
- Nothing — dragon isn't a real word to Python
Why: I say dragon, with no quote marks. The quotes tell Python where your words begin and end; they never get spoken.
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
A rune door stands between the dragon and its gold. Runes are fussy: this one opens only when it hears the exact words carved on it — hello dragon. The dragon walks up to it; you give it the words to say.
- +2
PracticeTwo 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.