CurriculumPython input() and Type Conversion for KidsThe Dragon's Three Questions

Practice Challenge: Three Questions with Python input()

input(), int(), and choosing which answers actually need converting — all at once.

Lesson 4 of 5PROAges 10+
See what PRO unlocks →

The Dragon's Three Questions

You've learned three things about talking to the player. Let's put them together.

One: input() asks and really waits for an answer, which always arrives as text.

Two: int() converts that text into a real number you can do math with.

Three: forgetting int() before adding or comparing crashes with a real TypeError — Python's honest way of saying 'this is still text'.

The challenge ahead asks three questions. Some answers need int(), one doesn't — figuring out which is the whole point.

Check your understanding

You ask for a player's NAME with input(). Do you need int() before printing it?

name = input("Name? ")
print(name)
  • No — you only need int() when you're going to do MATH with the answer
  • 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.

What you'll practice

Ask "How many gems? " and print TREASURE! if the number is 10 or more, otherwise print KEEP LOOKING. The player will type 15.

Unlock this lesson with PRO →

More from this topic

The Dragon's Three Questions is one lesson inside Python input() and Type Conversion for Kids — see the full lesson order and what the whole topic covers.

View the full topic →