Tutorpip← About this lessonOpen the sheet →Download PDF
Ages 10+ · Coding · Python
Hello, Python
Python reads• print("Hello")• print("I am Bo")Bo's screen shows• Hello• I am Bo
Each line of Python does one thing, from the top down.
The big ideaPython is code written in words. It reads one line at a time, top to bottom.

How it works

Python is code written in words. A computer reads it one line at a time, from the top line down.

Print is a command that shows something on the screen. It needs brackets, and the text goes inside quotes.

Quotes tell Python that something is text. Print shows only what is inside the quotes.

An error message is a clue that points at the line to fix. The computer is fine.

Write a lineRun itPython readsthe top lineThen the nextline down
How Python runs a program.

Example 1: One line

  1. Zara types print("Hello") and runs it.
  2. Print is the command, and Hello is the text inside the quotes.
  3. Bo's screen shows the word Hello.

Example 2: Two lines

  1. Line 1 is print("Hello"), and line 2 is print("I am Bo").
  2. Python reads line 1 first and line 2 next.
  3. Bo's screen shows Hello, and then I am Bo.

Example 3: A missing quote

  1. Leo types print("Hello Leo) and forgets the last quote.
  2. Python stops and points at the line, and the message is a clue.
  3. The mix-up to fix: put the closing quote back, so the line reads print("Hello Leo").
  4. Bo's screen says Hello Leo.

Example 4: A small letter p

  1. The line Print("hello") does not work, because Python needs a small letter p in print.
  2. The mix-up to fix: write print("hello").

Words to know

Python
A language for writing code in words.
command
A word that tells the computer to do something, like print.
text
Words inside quotes. Python shows text exactly as it is written.
error message
A clue that points at the line to fix.

Watch out

Try it

  1. What does print("I am Bo") show on the screen?
  2. Which line has a mix-up to fix: print("Hi Zara") or print(Hi Zara)?
  3. A program has two lines: print("A") and then print("B"). Which does the screen show first?
  4. Leo writes print("Hello) and a message points at it. What is the mix-up to fix?
  5. True or false: an error message means the computer is broken.
Answers: 1. I am Bo · 2. print(Hi Zara) · 3. A · 4. The closing quote is missing · 5. False
Try at homeAsk a grown-up to write three short instructions on paper, one per line, like clap, stamp, spin. You are the computer. Read from the top line down and do exactly what each line says, nothing more. Then swap: you write, they do.
For grown-upsIf you can run Python, type one print line together, run it, then take away one quote on purpose and read the message as a clue. If not, play the Mission: write three short instructions on paper, one to a line, and be the computer.
Open these notes on screenScan the code, or go to tutorpip.com.