Scratch scripts and typed Python side by side

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Scratch scripts and typed Python side by side

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A Scratch script has three blocks stacked one under the other. How many lines of Python match it?
A One line that holds all three blocks
B Three lines, one line for each block
2. Which Python line matches the Scratch block: say Hello!?
A print(Hello!)
B print("Hello!")
3. The Scratch script is: when green flag clicked, say Hi, say Bye. In which order does the Python code run?
A Hi first, then Bye, from the top line down
B Bye first, then Hi, from the bottom line up
4. What does the 'when green flag clicked' hat block match in a Python file?
A The first line of the file, where the program starts
B A special line that must be typed at the very end
5. How do you build a program in Python compared to Scratch?
A You type each line with the keyboard
B You drag each line from a palette

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1print("Hi") AThe closing bracket is missing. Every opening bracket needs a matching closing bracket to finish the line.
2name = input("Name? ") Bprint("Start")
3A stack of three Scratch blocks becomes three lines of Python that run in order from the top CPython is case sensitive, so Print with a capital P is not the print function. It must be lowercase print.
4The script under the green flag hat block becomes the first line of the file, so the program starts there Dprint("Ready") print("Set") print("Go")
5Print("Hi") EThe typed Python line that matches a Scratch say block with the word Hi
6print("Hi" FThe typed Python line that matches a Scratch ask block, with the reply stored in name

Definitions

print("Hi")

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
_____("Hi")
2.
score = 0 score = _____ + 1
3.
name = _____("Your name? ")
4.
# repeat 3 ___ i in range(3): print("Hi")
5.
name = input("Name? ") print("Hi " _ name)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A # when green flag clicked
B name = input("Name? ")
C print("Hello")
D Print(name)
Question 2
A # when green flag clicked
B print("Ready")
C score = 0
D print("Score:" score)
Question 3
A when green flag clicked
B print("Go!")
C print("Set")
Question 4
A # say Hello for 2 seconds
B print("Hello)
C # say Bye
D print("Bye")
Question 5
A # ask and wait
B answer = input("Name?"
C print("Hi " + answer)

Answer Key

Scratch scripts and typed Python side by side
Section A: Quick Questions
Q1
B — Three lines, one line for each block
Q2
B — print("Hello!")
Q3
A — Hi first, then Bye, from the top line down
Q4
A — The first line of the file, where the program starts
Q5
A — You type each line with the keyboard
Section B: Match the Pairs
Q1
print("Hi") → The typed Python line that matches a Scratch say block with the word Hi
Q2
name = input("Name? ") → The typed Python line that matches a Scratch ask block, with the reply stored in name
Q3
A stack of three Scratch blocks becomes three lines of Python that run in order from the top → print("Ready") print("Set") print("Go")
Q4
The script under the green flag hat block becomes the first line of the file, so the program starts there → print("Start")
Q5
Print("Hi") → Python is case sensitive, so Print with a capital P is not the print function. It must be lowercase print.
Q6
print("Hi" → The closing bracket is missing. Every opening bracket needs a matching closing bracket to finish the line.
Section C: Definitions
Q1
print("Hi") — One typed line of Python matches one Scratch block. A stack of blocks becomes lines of code that run in order from the top, so spelling and punctuation must be exact.
Section D: Fill in the Blanks
Q1
print("Hi")
Q2
score = 0 score = score + 1
Q3
name = input("Your name? ")
Q4
# repeat 3 for i in range(3): print("Hi")
Q5
name = input("Name? ") print("Hi " + name)
Section E: Spot the Error
Q1
D — Python is case sensitive. The Scratch say block becomes print() with a lowercase p. Print is not a known name. It should be print(name).
Q2
D — Items inside print() must be separated by a comma, just as a Scratch block needs each value in its own slot. It should be print("Score:", score).
Q3
A — The green flag hat block is only a note about the start of the script. In Python it must be a comment starting with #. Without the # Python tries to run it and gives a SyntaxError.
Q4
B — Text needs a closing quote, like the whole text in a block's input slot. The line should be print("Hello").
Q5
B — The bracket opened after input is never closed. Every opening bracket needs a matching closing one. It should be answer = input("Name?").