Python Quest: Say Hello to the Computer
Materials Needed
- Computer with a keyboard
- Internet access
- Python environment, such as Python’s online shell, Trinket, or another teacher-approved coding platform
- Typing practice website or a prepared typing passage
- Notebook or digital document for coding notes
- Lesson code examples
- Optional: headphones and a timer
Lesson Information
- Age: 14
- Level: First-year coding
- Curricular connection: Irish Junior Cycle Digital Learning and computational thinking skills
- Duration: 60 minutes
- Previous learning: Typing practice
- Today’s focus: Python,
print(),input(), and variables
Learning Objectives
By the end of the lesson, the learner will be able to:
- Type simple Python code accurately, including brackets, quotation marks, and equal signs.
- Use
print()to display a message on the screen. - Use
input()to ask the user a question. - Store information in a variable.
- Create a short interactive “Hello” program using at least one variable, one
input(), and twoprint()statements. - Explain that a variable is a named place where a program stores information.
Success Criteria
Success looks like this:
- I can explain what
print(),input(), and a variable do. - My program runs without errors.
- My program asks the user for information and uses the answer later.
- I can change my program to make it personal or creative.
- I can explain one mistake I fixed or one improvement I made.
Lesson Structure
1. Introduction and Hook — 5 minutes
Hook: Ask:
“If your computer could greet you by name every time you opened it, what would you want it to say?”
Explain:
“Today, you are going to write your first Python program. Python is a programming language used for websites, games, data, artificial intelligence, and automation. You will teach the computer to say hello, ask a question, remember the answer, and respond.”
Share the plan with the learner:
- Practise accurate typing for 15 minutes.
- Learn three basic Python ideas.
- Build a simple interactive “Hello” program.
- Customise the program and test it.
2. Continued Typing Practice — 15 minutes
Activity: Coding Typing Warm-Up
Use a typing website or type the following lines into a document. Focus on accuracy rather than speed.
print("Hello")
name = input("What is your name? ")
print(name)
message = "Welcome to Python!"
print(message)
Typing goals:
- Use both hands where possible.
- Look carefully for capital letters, brackets, quotation marks, and punctuation.
- Keep the cursor position accurate.
- Correct errors instead of ignoring them.
Quick reflection: Ask the learner:
- Which character was easiest to mistype?
- Why is careful typing important when writing code?
- What is different about typing code compared with typing a paragraph?
Formative assessment: Check whether the learner can correctly type:
- Round brackets:
( ) - Quotation marks:
" " - Equal sign:
= - Underscore:
_
3. Introducing Python — 10 minutes
I Do: Demonstration
Open the Python environment and explain that Python reads instructions from top to bottom. Type and run:
print("Hello, world!")
Explain:
print()tells Python to show something on the screen.- The message inside quotation marks is called a string. A string is text.
- Brackets show what information belongs to
print().
Try changing the message:
print("Hello from my first Python program!")
print("Coding is a creative skill.")
Check for understanding:
- What will appear on the screen?
- What would happen if the quotation marks were missing?
- What would happen if the spelling of
printchanged?
I Do: Introducing Input
Demonstrate:
input("Press Enter to begin.")
Explain:
“The input() function pauses the program and waits for the user to type something or press Enter. It allows the user to interact with the program.”
Next demonstrate:
name = input("What is your name? ")
print(name)
Explain:
nameis a variable.- The variable stores the answer typed by the user.
- The equal sign assigns information to the variable; it does not mean “is equal to” in the same way as a maths equation.
- Python can use the stored answer later.
4. Guided Practice: Build the “Hello” Program — 12 minutes
We Do: Code Along
Build the program one line at a time. The learner should type each line rather than simply copying the entire program.
print("Hello! Welcome to my Python program.")
name = input("What is your name? ")
print("Nice to meet you, " + name + "!")
Run the program and test it with a real name.
Discuss each line:
- The first
print()displays a welcome message. - The
input()asks a question. - The answer is stored in the variable called
name. - The final
print()uses the stored answer.
Think-pair-share alternative: If another person is available, ask the learner to explain the program to them. If working independently, have the learner explain each line aloud or write a short explanation in a notebook.
Quick prediction check: Before running this code, ask:
- What will the computer ask first?
- What information is stored in
name? - What will happen if the user types “Rory”?
5. Independent Creative Challenge — 10 minutes
You Do: Personalise the Program
The learner chooses one challenge. The program must still use print(), input(), and at least two variables.
Option A: Coding Club Welcome
print("Welcome to the coding club!")
name = input("What is your name? ")
favourite_language = input("What coding language would you like to learn? ")
print(name + " wants to learn " + favourite_language + ".")
print("That sounds interesting!")
Option B: Game Character Creator
print("Create your game character!")
character = input("What is your character's name? ")
power = input("What special power do they have? ")
print(character + " has the power of " + power + "!")
print("Your adventure is about to begin.")
Option C: Make Your Own
Create a program that welcomes someone, asks two questions, and responds using both answers. Possible themes include:
- A music recommendation program
- A holiday planner
- A pet introduction
- A sports team welcome
- A school or homeschool timetable assistant
Independent instructions:
- Write a welcoming
print()message. - Use
input()to ask a question. - Store the answer in a clearly named variable.
- Ask a second question and store that answer in another variable.
- Use both variables in a final message.
- Run the program at least twice with different answers.
6. Debugging and Feedback — 5 minutes
Explain that programmers expect errors. Debugging means finding and fixing problems in code.
Use this debugging checklist:
- Are all brackets closed?
- Are all quotation marks paired?
- Is
printspelt correctly and written in lowercase? - Are variable names consistent?
- Did the learner accidentally use a variable name that does not exist?
- Are the lines in a sensible order?
Common error example:
name = input("What is your name? ")
print("Hello, " + Name)
Ask the learner to identify the problem. Explain that Python treats name and Name as different names. This is called being case-sensitive.
Feedback prompt: Give specific feedback using:
- “One thing your program does well is…”
- “One change that would make it clearer or more interesting is…”
7. Conclusion and Assessment — 3 minutes
Exit Ticket
The learner answers these questions verbally or in writing:
- What does
print()do? - What does
input()do? - What is a variable?
- What information did your program store?
- What was one error or challenge you solved?
Summative Demonstration
The learner runs their completed program and explains:
- Where the program displays text
- Where it asks for user input
- Which variables store information
- How the final response uses the user’s answers
Assessment Evidence
- Typing practice: Accurate use of coding symbols and punctuation
- During learning: Answers to prediction and explanation questions
- Practical task: A working interactive Python program
- Reflection: Explanation of a debugging step or improvement
Differentiation and Adaptations
Support for a Learner Who Needs More Guidance
- Provide a partially completed program with the missing words highlighted.
- Use one variable first, then add a second variable.
- Allow the learner to copy a line, run it, and explain it before moving on.
- Keep a reference card visible:
print("text")
answer = input("Question? ")
print(answer)
Extension for a Learner Ready for More Challenge
- Ask for three pieces of information instead of two.
- Use a variable to store a welcome message.
- Experiment with multi-line output using several
print()statements. - Investigate f-strings:
name = input("What is your name? ")
print(f"Hello, {name}!")
- Compare the f-string version with the version using
+.
Different Learning Formats
- Homeschool: The adult can act as the user and test the program with different answers.
- Classroom: Learners can test a partner’s program and give one positive comment and one suggestion.
- Online or training setting: Learners can share their code and explain one line during a short presentation.
- Low-tech option: Write the code on paper and predict the output before using a computer.
Next Lesson Link
In the next lesson, revisit variables and introduce numbers, simple calculations, and combining text with user input to create a personalised calculator or mini quiz.