Beginner Python Lesson for Kids: Print, Input, Variables & Debugging

A 60–75 minute beginner Python lesson for 12-year-olds. Learn typing skills, print(), input(), variables, interactive programs, debugging, and computational thinking through a personalised Hello Python project.

Previous Lesson
PDF

Lesson: Hello, Python! — My First Program

Materials Needed

  • Computer or laptop with a keyboard
  • Internet connection, if using Code Club online materials
  • Python editor, such as Code Club’s online editor, Scratch Code Club workspace, Replit, or Thonny
  • Typing practice website or a prepared typing passage
  • Notebook and pencil
  • Optional: printed “Python Detective” challenge cards

Lesson Overview

Age: 12 years

Subject: Coding and Digital Learning

Irish curriculum connection: This lesson supports Junior Cycle Digital Learning and key skills, especially managing information and thinking, communicating, staying well, and working with others. It develops computational thinking, problem-solving, creativity, and digital confidence.

Suggested length: 60–75 minutes

Learning Objectives

By the end of the lesson, the learner will be able to:

  • Type accurately for 15 minutes while using good keyboard habits.
  • Explain that Python is a programming language used to give instructions to a computer.
  • Use print() to display words and messages.
  • Use input() to ask the user a question.
  • Store information in a variable and use that variable in a program.
  • Make and test a short interactive Python program.
  • Find and correct at least one simple coding error.

Success Criteria

I am successful if I can:

  • Write a working print() command.
  • Create a variable with a clear name, such as name or favourite_food.
  • Use input() to collect an answer.
  • Display the answer in a friendly message.
  • Test my program and improve it when something goes wrong.

Key Vocabulary

  • Python: A programming language.
  • Code: Instructions written for a computer.
  • Program: A set of instructions that a computer follows.
  • Function: A built-in command that performs a task.
  • Variable: A named storage space for information.
  • String: Text inside quotation marks.
  • Bug: A mistake in a program.
  • Debugging: Finding and fixing mistakes in code.

Assessment Plan

  • Formative assessment: Observe typing technique, ask prediction questions, check code after each small step, and listen to explanations.
  • Practical assessment: The learner creates and runs a personalised interactive “Hello” program.
  • Reflection: The learner explains what print(), input(), and a variable do.

Lesson Structure

1. Introduction and Typing Warm-Up — 15 Minutes

Typing Practice

Begin with continued typing practice from the previous lesson.

  1. Ask the learner to sit comfortably with both feet on the floor.
  2. Remind them to look at the screen rather than the keyboard as much as possible.
  3. Encourage gentle key presses, correct finger placement, and accuracy before speed.
  4. Have the learner complete one or two short typing activities.
  5. Record one result, such as words per minute, accuracy, or a personal goal.

Typing challenge: Ask the learner to type the following sentence carefully:

Python helps people give clear instructions to computers.

Quick reflection:

  • What was easier than last time?
  • Which letters or symbols were tricky?
  • What typing goal will you try to improve next time?

2. Hook and Lesson Goals — 5 Minutes

Ask:

How could you make a computer greet every visitor to your website, game, or app?

Explain:

“Today you are going to write your first Python program. You will make the computer say hello, ask questions, remember answers, and respond to the user.”

Show the learner the three commands they will meet:

print()
input()
name =

Tell the learner that the lesson will follow three steps:

  1. I do: Watch a short demonstration.
  2. We do: Build a program together.
  3. You do: Create and personalise a program independently.

3. I Do: Meet Python and print() — 10 Minutes

Open the Python editor. Explain that Python reads code from top to bottom.

Type and run:

print("Hello, world!")

Explain:

  • print() tells Python to show something on the screen.
  • The words are inside quotation marks because they are text.
  • The brackets show what information should be used by the function.

Demonstrate a few more examples:

print("Welcome to Python!")
print("Coding is creative.")
print(12)

Ask the learner:

  • What do you think will appear on the screen?
  • What happens if the quotation marks are removed from the words?
  • What might happen if a bracket is missing?

Quick check: Ask the learner to write one print() command that displays their favourite animal, food, or hobby.

4. We Do: Asking Questions with input() — 10 Minutes

Explain that a program becomes more interesting when it can interact with a person.

Type and run:

input("What is your name? ")

Explain:

  • input() asks the user to type an answer.
  • The message inside the brackets is called a prompt.
  • Python waits until the user types an answer and presses Enter.

Ask the learner to predict what this program will do:

print("Welcome!")
input("What is your favourite game? ")
print("That sounds fun!")

Run the code together and discuss the result.

5. We Do: Storing an Answer in a Variable — 10 Minutes

Explain that a variable is like a labelled box where the computer can store information.

Build this program together:

name = input("What is your name? ")
print("Hello, " + name + "!")

Explain each line:

  1. name is the label for the information.
  2. = means “store this information in”.
  3. input() collects the user’s answer.
  4. The answer is stored in the variable called name.
  5. The program uses name in the greeting.
  6. The + joins pieces of text together.

Ask the learner to change the program:

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

print("Hello, " + name + "!")
print("It is great that you enjoy " + hobby + ".

Remind the learner to include the final quotation mark in the last line. If appropriate, demonstrate a second version using an f-string:

print(f"Hello, {name}!")
print(f"It is great that you enjoy {hobby}.")

Explain that both versions join words and stored information together, but the first version is often easier for a beginner to understand.

6. You Do: Create a Personalised “Hello” Program — 15–20 Minutes

Challenge the learner to create a program that welcomes someone and learns at least three things about them.

Minimum requirements:

  • Use at least two input() commands.
  • Store answers in clearly named variables.
  • Use at least three print() commands.
  • Display a personalised message using the user’s answers.

Starter code:

print("Welcome to my Python program!")

name = input("What is your name? ")
favourite_food = input("What is your favourite food? ")
dream_place = input("Where would you like to visit? ")

print("Hello, " + name + "!")
print("I hear you like " + favourite_food + ".")
print("I hope you get to visit " + dream_place + " one day!")

Choice of themes: The learner may make the program about:

  • A friendly robot
  • A space explorer
  • A football or sports quiz
  • A favourite game
  • A dream holiday
  • A pet introduction
  • A school or homeschool welcome program

Creative upgrade options:

  • Add a fourth question.
  • Give the program a funny welcome message.
  • Ask the user for their age or favourite number and display it.
  • Add a closing message, such as “Thanks for chatting!”
  • Change the questions so the program has a clear theme.

7. Debugging Challenge — 5 Minutes

Explain that programmers expect mistakes. Finding and fixing mistakes is called debugging.

Ask the learner to find the problems in this code:

print("Welcome to Python!)
name = input("What is your name? "
print("Hello " + name)

Guide the learner to identify:

  • The missing quotation mark after Python!
  • The missing closing bracket in the input() line
  • The need to test the program after making a correction

Debugging routine:

  1. Read the error message carefully.
  2. Look at the line named by Python.
  3. Check brackets and quotation marks.
  4. Make one change at a time.
  5. Run the program again.

8. Conclusion and Reflection — 5–10 Minutes

Ask the learner to explain the following in their own words:

  • What does print() do?
  • What does input() do?
  • What is a variable?
  • Why do strings need quotation marks?
  • What does debugging mean?

Exit ticket: Complete these sentences:

  • “Today I learned that print()...”
  • “A variable is...”
  • “One mistake I fixed was...”
  • “Next time I would like my program to...”

Recap the lesson:

“Today you continued developing your typing skills and wrote your first Python program. You used print() to display messages, input() to ask questions, and variables to remember answers. You also practised testing and debugging, which are important skills for every programmer.”

Differentiation and Support

Support for a Learner Who Needs More Guidance

  • Provide a partially completed program with the missing words highlighted.
  • Focus first on one variable, such as name, before adding more.
  • Use a checklist: brackets, quotation marks, spelling, then run the code.
  • Allow the learner to copy one line at a time and explain each line aloud.
  • Use sentence starters such as print("I like...") and name = input("...").

Extension for a Learner Ready for More Challenge

  • Add more questions and variables.
  • Use an f-string to display answers.
  • Create a short story that changes based on the user’s answers.
  • Investigate what happens when a variable name contains a space.
  • Compare two versions of the program and explain which is easier to read.

Home Learning or Follow-Up

Create a “Python Profile” program that asks five questions and gives the user a personalised summary. The learner should save the program and add comments explaining what each section does.

Optional comment example:

# This program asks questions and creates a friendly profile.

Ask a question about this lesson

Loading...

Related Lesson Plans

How to Learn Any TikTok Dance: Easy Step-by-Step Tutorial Guide for Beginners

Master trending TikTok dances with this easy-to-follow, step-by-step guide! Learn how to choose a dance, break down move...

How to Roller Skate for Beginners: Easy Step-by-Step Lesson on Safety, Balance, Gliding & Stopping

Master the roller skating basics with our easy-to-follow guide for beginners! Learn essential safety tips, how to balanc...

Where Do Animals Live? Fun Lesson & Crafts on Animal Habitats for Kids

Discover where animals live with this fun science lesson for kids! Explore different animal homes like nests, burrows, d...

Learn Cheer Basics: Easy Guide to Motions, Jumps & Your First Cheer for Beginners

Learn fundamental cheerleading basics! This beginner's guide covers warm-ups, sharp arm motions (High V, Low V, T), a ba...

Laundry Super Skills: A Fun Guide to Teaching Kids How to Do Laundry Safely

Turn laundry chores into a fun adventure! Our step-by-step 'Laundry Super Skills' guide teaches kids essential washing, ...

Teaching Kids Good Manners: Fun Etiquette Lesson Plan & Activities

Easily teach children etiquette and the importance of good manners with this engaging lesson plan. Includes discussion p...