say() function

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

say() function

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. How many arguments does say() require?
A Two — text and a voice number
B One — just the text
2. Which of these is the correct way to call say()?
A say "Hello!", 1
B say("Hello!", 1)
3. What does the second argument in say() control?
A Which voice speaks the text
B How many times the text is spoken
4. say() displays text in the console panel.
A False
B True
5. Can you use different voice numbers in one program to represent different speakers?
A No — only one voice number is allowed per program
B Yes — use a different number for each speaker

Match the Pairs

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

Left columnRight column
1say("Hello!", 1) Asay("I am spoken", 1) print("I am visible")
2say("Hi!", 1) say("Hey!", 2) BSpeaks the text Hello! aloud using voice number 1
3The second argument in say() selects the voice CA two-speaker conversation using different voice numbers
4say() produces spoken audio; print() shows text in the console DWrong — say() requires two arguments: the text and a voice number
5say("Goodbye!") Esay("Welcome!", 2)
6Say("Hello!", 1) FWrong — say() must be all lowercase; Say() with a capital S is not recognised

Definitions

say()

Fill in the Blanks

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

1.
___("Hello there!", 1)
2.
say("Good morning!", _)
3.
say("Hello!", 1) ___("Hi back!", 2)
4.
say("How are you?", _)
5.
say("Goodbye!", 1) # This uses ___ for audio output

Spot the Error

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

Question 1
A say("Welcome!", 1)
B say("Thanks!", 2)
C say("See you later!)
Question 2
A say("Goodbye!", 2)
B say("See you!", 1)
C say("Hello!", 1)
D say "Hi again!", 1
Question 3
A # say() needs two arguments
B say("Bye!", 2)
C say("Hi there!")
Question 4
A say("Good morning!", 1)
B say("Good afternoon!", 2)
C say(Good evening!, 1)
Question 5
A Say("Hi!", 2)
B # Voice 1 speaks first
C say("Hello!", 1)

Answer Key

say() function
Section A: Quick Questions
Q1
A — Two — text and a voice number
Q2
B — say("Hello!", 1)
Q3
A — Which voice speaks the text
Q4
A — False
Q5
B — Yes — use a different number for each speaker
Section B: Match the Pairs
Q1
say("Hello!", 1) → Speaks the text Hello! aloud using voice number 1
Q2
say("Hi!", 1) say("Hey!", 2) → A two-speaker conversation using different voice numbers
Q3
The second argument in say() selects the voice → say("Welcome!", 2)
Q4
say() produces spoken audio; print() shows text in the console → say("I am spoken", 1) print("I am visible")
Q5
say("Goodbye!") → Wrong — say() requires two arguments: the text and a voice number
Q6
Say("Hello!", 1) → Wrong — say() must be all lowercase; Say() with a capital S is not recognised
Section C: Definitions
Q1
say() — A custom function that speaks text aloud using text-to-speech; the first argument is the text to speak and the second argument is the voice number
Section D: Fill in the Blanks
Q1
say("Hello there!", 1)
Q2
say("Good morning!", 1)
Q3
say("Hello!", 1) say("Hi back!", 2)
Q4
say("How are you?", 2)
Q5
say("Goodbye!", 1) # This uses say for audio output
Section E: Spot the Error
Q1
C — The closing quote is missing from the string. It should be say("See you later!", 1) with a closing quote and a voice number. Line 2 is wrong.
Q2
D — say() must be called with parentheses. say "Hi again!", 1 is missing the brackets around the arguments. Line 3 is wrong.
Q3
C — say() requires two arguments: the text and a voice number. The voice number is missing on line 2. Line 2 is wrong.
Q4
C — The string argument must be wrapped in quote marks. Good evening! has no quotes around it. Line 2 is wrong.
Q5
A — say() must be all lowercase — Say() with a capital S is not recognised as the function. Line 0 is wrong.