Week 1 of 8
What is Python?
The first lesson. Students find out what code really is: exact instructions the computer follows in order. They write and run their own Python program using print() to put words on the screen, and see what happens when one instruction is typed wrong.
- Estimated time
- 50-60 minutes
- Project
- Digital Introduction Card
The idea
Code is a list of instructions, and the computer follows them in order without guessing. print() is the first instruction you will learn: it shows exactly the text between the quotation marks. Change the words in the quotes and the screen changes with them.
What you will learn
- Say, in their own words, what a program is.
- Write and run a program that uses print() to show text.
- Explain why the computer runs the lines in order, from top to bottom.
- Read a short error message and fix a missing quotation mark.
New words
- program
- A set of exact instructions the computer follows, one line at a time.
- print()
- A Python command that shows whatever text you put in the quotes on the screen.
- string
- A piece of text inside quotation marks, like "Hello".
- output
- Whatever the program shows on the screen when it runs.
- error
- The message Python shows when a line is written in a way it cannot follow.
Project: Digital Introduction Card
Edit the starter code below and press Run to see it work. Use Reset starter code to go back to the original at any time.
Run your program to see the output.
Expected output
Hi, I'm Alex.
I'm 10 years old.
The last game I played was soccer.Mini challenge
Add two more lines to your card: one about a game or hobby you like, and one about something you want to build this year.
Debugging challenge
This line should print the word Hello, but it stops the program with an error instead. Look at what is missing around the word Hello. Every piece of text in Python needs it.
Broken code
print(Hello)Show solutionHide solution
Put quotation marks around the text:
print("Hello")Extension challenge
Add a blank line to your card by writing print() with nothing inside the parentheses. Use it to split your card into two neat sections.
Reflect
The computer followed your lines in the exact order you wrote them. In the game you build at the end of this program, order will matter too. What would go wrong if a game printed "You win!" before the player even took a turn?
Teacher notes
The big idea is that the computer is literal: it prints exactly what is in the quotes, in order, and nothing more. The two errors you will see most are a missing quotation mark and a missing parenthesis. Treat them as the first bugs students find and fix, not as failure. Have students read their output aloud to check it says what they meant.
Facilitating this lesson? See the teacher & librarian guide for how to run it, common mistakes, and an offline backup activity.
Finished this lesson? Mark it complete to unlock the next week.