The dragon explains
input() asks, and really waits
The dragon: Everything you've written so far runs the instant you press Run. input() is different — it actually stops and waits.
The dragon: input() shows a question, waits for an answer, and hands that answer back to you as a value you can store.
example.pyPython 3name = input("What is your name? ")print(name)
The dragon: Nothing before this point ever waited for YOU. print(), if, for — none of them pause. input() is the one exception.
The dragon: Whatever the player types comes back as TEXT — even if they type a number. That matters, and we'll come back to it.
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
You write print("Hello") with no input() anywhere. Does the program wait for you to type anything?
question.pyPython 3print("Hello")- No — it just runs straight through and finishesCorrect
- Yes, it always pauses in case you want to type something
Why: It runs straight through with no pause. Only input() makes a program wait for something you type.
Question 2 of 2
name = input("Name? "). What TYPE of value does name hold, even if the player types "7"?
question.pyPython 3name = input("Age? ")- Text (a string) — always, no matter what was typedCorrect
- A number, if the player typed digits
Why: input() always returns text — a string — no matter what the player types. "7" looks like a number to us, but Python treats it as three characters until you convert it.
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
input() asks a question and waits for the answer. Use input("What is your name? ") to ask, store the answer in a box called name, then print it back.
- +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.