Junior Codes
Message Harbour

Python input() for Kids

Ask the person using your program a question and use their answer.

Start Wonderwild free with Pip

Try 5 starter activities free. Full access is ₹499 a year.

This mission is part of full access. The first missions are free to try.

input(), explained simply

So far your programs talk, but they cannot listen. input() changes that. It shows a question, waits for the person to type something and press Enter, then hands back what they typed.

You usually store the answer in a variable so you can use it later: name = input("What is your name? ").

Whatever someone types comes back as text (a string), even if they type digits. You can join text together with + or, more easily, put it in an f-string.

Example: A talking ticket booth

name = input("What is your name? ")
place = input("Where are you going? ")
print("Ticket for " + name + " to " + place)

Output

What is your name? Kabir
Where are you going? the lighthouse
Ticket for Kabir to the lighthouse

The words after each question are what the person typed.

Try this

  • Ask for someone’s favourite colour and reply with a sentence that uses it.
  • Leave out the spaces around the + signs in the text and see how the words squash together.
  • Rewrite the last line using an f-string instead of +.

Practise it in Wonderwild

“The talking ticket booth”

Mission 8 in Message Harbour, one of 36 Python missions in Wonderwild.

Your child writes and runs real Python in the browser while Pip reacts to every line. Nothing to install. For ages 7+.

Start Wonderwild free with Pip

Try 5 starter activities free. Full access is ₹499 a year.

This mission is part of full access. The first missions are free to try.

Questions parents and kids ask

Why does input() always give back text?+

Python cannot know whether "12" is meant as a number or as a word, so it plays safe and gives you text. You convert it to a number yourself when you need to do maths.

Why add a space at the end of the question?+

So the answer does not appear squashed against the question mark. It is a small touch that makes a program feel friendlier.

Prefer learning with a teacher?

Our live Python for Young Developers course teaches these ideas in small online classes led by a software engineer, with projects and feedback. Every live course also includes 12 months of full Wonderwild access for practice.

See the Python for Young Developers course