Class 9 · Unit 0: Refresher · Lesson 0.1 · 40 min
Back at the laptop
Rahat leaves out one bracket and the screen fills with red. It isn't broken. It did exactly what he wrote.
Today you will: Run your first line of Python · Read an error message calmly · List three problems — and the data that proves them
Story
First day back. Rahat has the laptop open before Hiba has sat down.
Hiba: “Watch this.” (He types one line, presses the green button, and the word Assalamu alaikum appears at the bottom of the screen.)
Hiba: “It understood you.” (straight-faced.)
Rahat: “Obviously it understood me.”
Hiba: “Did it? Type it again, but leave out one bracket.”
He does. The screen fills with red text.
Rahat stares at it. "It's broken."
Rahat: “It isn't broken. It did exactly what you wrote. That's the whole difference this year. Last year we trained machines. This year we tell them, and a machine does what you wrote — not what you meant.” (Hiba pulls the laptop over.)
Watch
Back at the laptop — — scan code 9.0.1 in the printed book.
Learn it
Last year you trained machines; this year you will also tell them, by writing programs. A program is a list of instructions a machine follows exactly: it does what you wrote, not what you meant. Leave out one bracket and it stops. That is not the machine being broken or rude. It is the machine telling you which line it could not follow.
Words to know
- Program instructions a computer follows exactly, written in a programming language such as Python.
- Thonny the program we write Python in. It runs on the laptop itself, with no internet needed.
- Editor the top half of Thonny, where you write and save a program.
- Shell the bottom half, where the program runs and shows its output.
- Error message red text naming the line the computer could not follow, and why. It is information, not a telling-off.
- Syntax the exact spelling and punctuation a programming language needs: every bracket, quote and colon.
Step by step: reading your first error
print("Salaam, Class 9"
- Run it. Red text appears in the shell, ending with something like
SyntaxErrorand a line number. - Go to that line. Count the brackets: one
(opened, none closed. - Fix one thing: add the
). - Run again:
Salaam, Class 9appears. Read the message, find the line, fix it, run again: that is the whole skill.
Why typing accuracy matters more now: print("x" and print("x") are one character apart, and
one of them does nothing at all.
A problem worth solving needs data. For your three problems, the hard column is what data would show it is real: not "everyone knows", but "the arrival time of the 8 a.m. bus, written down every school day for a month".
Careful: don't clear an error and start again. The message tells you exactly where to look.
And this year typing practice is about accuracy, not speed: print("x" and print("x") are
one character apart, and one wrong character stops a program.
On the laptop
You need: File Manager · Thonny · LibreOffice Calc · typing.com
Mission 1: Your folder (2 min)
- ☐1
In the
Class-9folder, openmy-workand make a folder named with your roll number only, e.g.09-roll-12.
Mission 2: Your first program (9 min)
- ☐2
Open Thonny: the editor on top, where programs are written; the shell below, where they run.
- ☐3
Type exactly — every bracket, every quote:
print("Assalamu alaikum") - ☐4
Save it as
hello.pyin your folder and press Run (the green arrow). - ☐5
Predict: what will happen if you delete the last bracket? Write it down. Then do it and Run.
- ☐6
Read the red message. Find the line number it names. Put the bracket back and Run again.
Mission 3: Three problems (5 min)
- ☐7
In Calc, headings: Problem · Who has it · What data would show it is real.
- ☐8
Fill three problems you've seen in your school, street or village. The third column is the hard one: not "everyone knows" but "hours the tap ran, written down daily for a month".
- ☐9
Save as
problems.ods. Keep it — one line may become your year project.
Mission 4: Typing baseline (5 min)
- ☐10
Log in to typing.com with your new card. Take the one-minute test; write your WPM, accuracy and Term 1 goal on the card. Log out and shut down properly.
No laptop today?
Write the one-line program on paper, then write it again with one mistake and ask a partner to find it. Fill the three-problems table in your notebook and do the typing test next lab period.
Debate it
Rahat said the computer "understood" him.
Did it? It produced exactly the greeting he asked for — and then produced nothing at all when one bracket was missing. A person reading the same line with a bracket missing would have understood it perfectly.
So what is the machine actually doing, if it is not understanding? And why does the answer matter before you ask a machine to make a decision about somebody?
Check yourself — practice, not a test
1. Your program will not run and red text appears. The first thing to do is:
- ○ Delete the program and start again
- ○ Call the teacher before reading anything
- ○ Read the message and find the line number it names
- ○ Restart the laptop
2. Thonny needs an internet connection to run a Python program. (Python is installed with Thonny and runs on the laptop itself)
- ○ True
- ○ False
3. A program does what you ______, not what you meant.
4. Which folder name follows our privacy rule?
- ○ hiba-9B-nowgam
- ○ 09-roll-04
- ○ hiba-dar-abba-phone
- ○ hiba9
5. Which of these is a usable answer in the column "What data would show it is real"?
- ○ Everyone says the bus is always late
- ○ The arrival time of the 8 a.m. bus, written down every school day for a month
- ○ The bus is a big problem for students
- ○ Somebody should fix the buses
Remember
The computer does what you wrote, not what you meant.
Typing practice
Skill: the symbols code is made of — ( ) : " = _ [ ]
- On typing.com, open the symbols lessons your teacher sets for the first week.
- These eight characters will appear in every program you write this year. Most of them need Shift, so use the Shift key on the opposite hand to the symbol.
- Accuracy before speed, always. In a sentence, a wrong bracket is a typo. In a program, it is the difference between working and not working.
- Class 9 Term 1 target, to reach by May: 32–38 WPM at 94% accuracy or better. Today is only a starting line.