The dragon explains
The Dragon's Three Questions
The dragon: You've learned three things about talking to the player. Let's put them together.
The dragon: One: input() asks and really waits for an answer, which always arrives as text.
The dragon: Two: int() converts that text into a real number you can do math with.
The dragon: Three: forgetting int() before adding or comparing crashes with a real TypeError — Python's honest way of saying 'this is still text'.
The dragon: The challenge ahead asks three questions. Some answers need int(), one doesn't — figuring out which is the whole point.
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 1
You ask for a player's NAME with input(). Do you need int() before printing it?
question.pyPython 3name = input("Name? ")print(name)
- No — you only need int() when you're going to do MATH with the answerCorrect
- Yes — every input() answer needs int() before you can use it
Why: No int() needed here — a name is used as text, not a number. int() only matters when you're about to do math with the answer.
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
Ask "How many gems? " and print TREASURE! if the number is 10 or more, otherwise print KEEP LOOKING. The player will type 15.
- +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.