Python Builder Lab · Lesson 1 of 10

Python Input and Basic Program Flow

Take user input, clean it lightly, and move through a simple script from start to finish.

Academy Plus Preview available 3 practice exercises 1 homework item

What you will learn

  • Explain how Python input, variables, and print work together in a tiny script.
  • Describe top-to-bottom program flow in beginner language.
  • Store entered values in variables and reuse them in output.
  • Read a two-input Python example line by line.
  • Avoid common first-script mistakes around prompts, variable names, and output.

Lesson shape

18 minute lesson with 8 sections, 3 exercises, 3 checkpoint questions, and 1 homework submission.

This track requires the Academy Plus plan.

Lesson preview

Step-by-step structure before you start

Overview

Welcome to Python Builder Lab

This is the first lesson in Python Builder Lab.

In the previous track, JavaScript helped you make browser pages respond to clicks, forms, lists, and saved state.

Python starts from a different place. In this track, you will begin with small scripts: short programs that ask for information, store values, move step by step, and print useful output.

The habit is still familiar:

Read input.

Store data.

Move through the steps in order.

Show the result clearly.

You are not jumping into advanced Python. You are learning how a small script thinks from the first line to the last line.

A calm shift from browser to script

JavaScript focused on page interaction. Python Builder Lab begins with text-based program flow and practical script logic.

Explain

Python usually runs from top to bottom

A simple Python program usually starts at the first line and moves downward one line at a time.

That order is called program flow.

If line 1 asks for a name, line 2 can use the answer.

If line 3 stores a goal, line 4 can print that goal.

Earlier lines affect later lines because later lines can reuse values that were created above them.

This makes Python scripts easier to trace when they stay small. You can point to each line and ask: what value exists now, and what line runs next?

Order matters

Python does not magically know future answers. A later line can only use values that already exist.

example

input() asks, pauses, and waits

Python uses input() when a script needs the user to type something.

The text inside input() is the prompt. It is the question or instruction the user sees.

Example:

name = input("What is your name? ")

When Python reaches that line, the script pauses. It waits until the user types an answer and presses Enter.

The prompt text is not the answer. The answer is the value the user types.

The variable name stores that typed value so the script can use it later.

Prompt versus stored value

The prompt is the question. The stored value is what the user typed back.

Explain

Variables hold entered values for later

A variable is a named place to keep a value.

In this lesson, the value often comes from input().

Example:

goal = input("What do you want to practice? ")

The variable is goal.

The prompt is "What do you want to practice?"

The stored value might be "Python basics" if that is what the student typed.

Later, print() can reuse goal:

print("Today you are practicing " + goal)

You do not need a complicated definition yet. For now, a variable stores something so a later line can use it.

Store now, use later

Variables make scripts useful because one line can remember information for another line.

example

Worked example: ask twice, then respond

Read this small script slowly:

student_name = input("What is your name? ")
learning_goal = input("What do you want to practice today? ")

print("Hi " + student_name + ".")
print("Today you are practicing " + learning_goal + ".")

Line 1 asks for the student's name and stores the answer in student_name.

Line 2 asks for the student's learning goal and stores the answer in learning_goal.

Line 3 prints a greeting that includes student_name.

Line 4 prints a second sentence that includes learning_goal.

If the student types Maya and Python basics, the output can be:

Hi Maya.
Today you are practicing Python basics.

Nothing here is hidden. The script asks, stores, and prints in a readable order.

Trace one line at a time

The easiest way to read a beginner script is to follow the values from the first input line to the final print line.

Practice

A useful script is a clear sequence

A beginner Python script can follow a simple sequence:

Ask a question.

Receive a value.

Store the value in a variable.

Ask the next question.

Store the next value.

Print a result that uses those stored values.

The order matters. If you try to print a variable before it has been created, Python cannot use it.

If you overwrite a variable too early, the later output may use the newer value instead of the one you meant to keep.

Small scripts teach you to respect the path from input to output.

Follow the path

Ask, store, ask again, store again, then print. That simple path is enough for a useful first Python script.

Practice

Common first input and print mistakes

Beginner Python mistakes are normal. The fix is usually to slow down and check one line.

Mistake 1: Forgetting parentheses on input or print.

Mistake 2: Expecting input() to continue without the user typing and pressing Enter.

Mistake 3: Creating name but later typing studentName or Name instead.

Mistake 4: Printing only plain text when you meant to include the variable too.

Mistake 5: Assuming Python reads the whole script all at once instead of running step by step.

Mistake 6: Accidentally overwriting a variable before the final output.

Mistake 7: Confusing the prompt text with the stored answer.

When something feels wrong, read the script from top to bottom and name what each line creates.

Most fixes are small

In early scripts, many bugs come from one missing pair of parentheses, one mismatched variable name, or one line in the wrong order.

Wrap up

Your first Python Builder Lab script

In this lesson's practice, you will build a tiny input-style script.

The goal is not to build a large program.

The goal is to show that you understand the first Python flow:

Ask for information.

Store it.

Use it in clear output.

The locked Practice Lab uses safe simulated responses instead of live input prompts, because browser-only Python practice does not allow interactive terminal access, files, packages, network calls, or system access.

That safety rule protects the learning environment. You still practice the same logic: values come in, variables store them, and print() shows the result.

Summary: Python can ask the user for information, programs run step by step, and input, variables, and print work together to create simple useful scripts.

Simple scripts are real progress

A clear two-input script is a strong first step into Python Builder Lab.

Homework

Assignments attached to this lesson

Text response

Python Input and Basic Program Flow: quick check

Write a short beginner explanation of the main idea from Python Input and Basic Program Flow.

Not started

Open homework