DPython for KidsModule 3 · Lesson 3.2
LESSON 3.2 · 40 MINUTES

Asking the User Questions

Interactive programs listen before they respond.

Discover

  • input() asks a question and returns text.
  • Store the answer in a variable.
  • Never ask for private details such as a full name, address or password.

Try, explain and change

Try: Build a safe idea prompt. Ask “What should we build? ”, store the answer in project, then print “Let us build” followed by the answer. The runner supplies “space game”.

Change: Try a different project idea and check that the reply changes with it.

SAFE PYTHON RUNNER

Try the challenge

No files · no network · safe lesson commands only

Build a safe idea prompt. Ask “What should we build? ”, store the answer in project, then print “Let us build” followed by the answer. The runner supplies “space game”.

Target output
What should we build? 
Let us build space game
Match the lines and order. Your code must use the lesson concept.

The runner supports this pathway’s controlled Python concepts while blocking packages, files, networks and system commands.

Output
Your output will appear here.
DEBUG DETECTIVE

Find the bug

project = input("What should we build? ")
print("Let us build", Project)
Show debugging clue

Variable names are case-sensitive: project and Project are different.

QUICK CHECK

Which question is safest?

What is your home address?

Not this time. Review Discover and try again.

What is your password?

Not this time. Review Discover and try again.

What should we build?

Correct — well reasoned.

Create and reflect

Create: Build a two-question idea generator without collecting personal information.

Reflect: Why should a program collect only the information it needs?

Stretch practice · self check

Ask for “robot garden” instead. Predict the reply without changing the print line.

Edit and run your code again to explore this variation. It does not change lesson completion.