Why Python input() Always Returns Text, Not a Number

input() always gives you text — int() is how you turn digits into a real, usable number.

  • Lesson 2 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

int() turns text into a number

  1. The dragon: input() always hands you text, even for a question like 'how old are you?'.

  2. The dragon: int(some_text) converts digit-text into a real number, one you can add, multiply, or compare.

    example.pyPython 3
    age_text = input("Age? ")age = int(age_text)print(age + 1)
  3. The dragon: You can also wrap the whole input() call directly: int(input("...")) does the same thing in one step.

    example.pyPython 3
    age = int(input("Age? "))
  4. The dragon: Without int(), Python treats the text like words — adding two of them GLUES them together instead of adding the numbers.

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

    gold_text = input("Gold? ") and the player types 5. What is gold_text + gold_text?

    question.pyPython 3
    gold_text = input("Gold? ")print(gold_text + gold_text)
    • "55" — the two pieces of text stuck togetherCorrect
    • 10 — Python adds them as numbers

    Why: "55". Without int(), gold_text is text, not a number — and adding two pieces of text joins them end to end.

  2. Question 2 of 2

    What does int(input("...")) do, compared to plain input("...")?

    • It converts whatever was typed into a real numberCorrect
    • Nothing different — input() already returns a number if you type digits

    Why: int() converts the text input() returns into a real number you can do math with. Without it, even '5' stays text.

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

    Ask "How much gold? " and wrap the answer in int(...) so it becomes a real number, not just digits-as-text. Then print that number plus 10.

  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.