Students meet print, text in quotes, and joining text with +, then make a four-line sign.
Console bridge: text in, text out · Text in, text out · about 30 minutes · Open the student lesson
Classroom resources
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
SlidesDownload Present from the browser, or export to PowerPoint or PDF.
WorksheetDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can show a line of text with print.
I can say why text needs quotes.
I can join pieces of text with + and say where the spaces come from.
Timing
Predict and Run 8 min · Investigate 12 min · Make 10 min
Running the lesson
Predict: show the two-line program and take a vote. The wrong options are a slip about new lines, a slip about what + does, and a slip about spaces.
Run: run it live, then change the space inside the quotes and run again. Ask where the space came from.
Investigate: the trace is the key idea, that + adds nothing. Ask a student to read a line aloud as if they were the computer.
Make: students choose their own sign. Show a friend a finished one and ask what each line does.
In class
On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
Read it like a computer(end, 3 min)
Swap signs with a partner. Read their program line by line and say aloud what each print shows. Does the screen match?
The hard part (on purpose)
Telling apart a name and text in quotes. Ask what print would show for the name without quotes.
When students get stuck
What you will see
A question to ask
The fix
A NameError mentioning a word the student meant as text.
Is that word inside quotes?
Text needs quotes. Without them Python looks for a name.
Words run together on the screen ("HiAda").
Where did the space come from in the first program?
A space is a character. Put it inside the quotes, such as "Hi, ".
Answers to the checks
Predict: What will the program show? Two lines: Hello, then Hi, Ada. Each print starts a new line. The + joins the two pieces exactly as typed, and the space after the comma is inside the quotes, so it stays.
Trace the lines: Fill in what each line shows. Hi, Ada, Hi,Ada, AdaAda A space only appears if it is inside the quotes. name + name joins Ada onto Ada with nothing between.
Spot the bug: This should show three lines, but the program stops with an error. Click the wrong line. line 2 Without quotes, Python reads Hi there as names it has never heard of. Text needs quotes around it: print("Hi there").
Put the lines in order: Put the lines in order so the screen shows a line of stars, then Room 12, then Welcome, then a line of stars. see the program below print runs the lines from the top down, so the order of the lines is the order on the screen.