Python input() Function Explained for Beginners

The one command that genuinely talks to the player — everything before this never did.

  • Lesson 1 of 5
  • PRO
  • Ages 10+
  • 3 hands-on levels
See what PRO unlocksA one-time $49.99 purchase. Topics 1–3 are free.

The dragon explains

input() asks, and really waits

  1. The dragon: Everything you've written so far runs the instant you press Run. input() is different — it actually stops and waits.

  2. 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 3
    name = input("What is your name? ")print(name)
  3. The dragon: Nothing before this point ever waited for YOU. print(), if, for — none of them pause. input() is the one exception.

  4. 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.

  1. Question 1 of 2

    You write print("Hello") with no input() anywhere. Does the program wait for you to type anything?

    question.pyPython 3
    print("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.

  2. Question 2 of 2

    name = input("Name? "). What TYPE of value does name hold, even if the player types "7"?

    question.pyPython 3
    name = 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. 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. +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 PRO

Stuck three times? The game offers the answer — unasked.