← Teacher guide

Print text

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.

Students will be able to

Timing

Predict and Run 8 min · Investigate 12 min · Make 10 min

Running the lesson

  1. 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.
  2. Run: run it live, then change the space inside the quotes and run again. Ask where the space came from.
  3. Investigate: the trace is the key idea, that + adds nothing. Ask a student to read a line aloud as if they were the computer.
  4. 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.

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 seeA question to askThe 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

  1. 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.
  2. 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.
  3. 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").
  4. 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.
    print("*****")
    print("Room 12")
    print("Welcome")
    print("*****")
    

Solutions

One possible solution for each task. Other correct programs are fine.

Make

name = "Room 12"
print("*********")
print("Welcome to " + name)
print("Please come in to " + name)
print("*********")

Stretch and support

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.

Exit ticket

print("Hi, " + "Sam") shows what, and why is there a space?

Hi, Sam. The space is inside the first quotes. The + adds nothing.

What each step is for

Where it leads

Next lesson: the program asks a question and uses the answer, so it is no longer the same every time.