Students meet print, text in quotes, and joining text with +, then make a four-line sign.
Core ideas this lesson introduces: Joining text needs Variables. How the ideas build
Pathway idea first taught here: A program that talks.
Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict and Run 8 min · Investigate 12 min · Make 10 min
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.
Swap signs with a partner. Read their program line by line and say aloud what each print shows. Does the screen match?
Telling apart a name and text in quotes. Ask what print would show for the name without quotes.
| 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, ". |
print("*****")
print("Room 12")
print("Welcome")
print("*****")
One possible solution for each task. Other correct programs are fine.
name = "Room 12"
print("*********")
print("Welcome to " + name)
print("Please come in to " + name)
print("*********")
Stretch: Print a box of stars around a message, using more than four print lines.
Support: Give the sign with one line missing and ask the student to complete it.
print("Hi, " + "Sam") shows what, and why is there a space?
Hi, Sam. The space is inside the first quotes. The + adds nothing.
Next lesson: the program asks a question and uses the answer, so it is no longer the same every time.