Combining Colour, Highlight and Style

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

Combining Colour, Highlight and Style

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Can Colour., Highlight., and Style. all be combined in one print() call?
A False
B True
2. Should combined values be joined using + or commas?
A +
B Commas
3. Does the order of Colour, Highlight, and Style matter for the effect to work?
A No, any order works
B Yes, they must be alphabetical
4. Should the string being displayed also be joined with +?
A False
B True
5. Should Colour, Highlight, and Style each start with a capital letter?
A True
B False

Match the Pairs

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

Left columnRight column
1print(Colour.red + Highlight.yellow + Style.bold + "Go!") ADisplays italic blue text with no highlight
2print(Colour.blue + Style.italic + "Stop!") BStyle should start with an uppercase S, not lowercase style
3Joining multiple dot-notation values with + before the string C+
4The symbol used to chain each effect together, including the final string DCombining Colour, Highlight and Style
5print(Colour.blue, Style.italic + "Stop!") EDisplays bold red text with a yellow highlight
6print(Colour.red + style.bold + "Danger") FCombined effects should be joined with +, not a comma

Definitions

Colour.red + Highlight.yellow + Style.bold

Fill in the Blanks

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

1.
print(Colour.red + _________.yellow + Style.bold + "Level up!")
2.
print(Colour.red + Highlight.yellow + _____.bold + "Level up!")
3.
print(Colour.blue _ Style.italic + "Warning!")
4.
print(Colour.green + Highlight.pink + Style.underline _ "Great job!")
5.
_____(Colour.gold + Style.bold + "Score: 100")

Spot the Error

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

Question 1
A print(Colour.blue, Style.italic + "Stop!")
B print(Colour.red + Highlight.yellow + Style.bold + "Go!")
C print(Colour.green + Style.underline + "Wait")
Question 2
A print(Colour.red + style.bold + "Danger")
B print(Colour.gold + Highlight.black + "Score")
C print(Highlight.pink + Style.italic + "Note")
Question 3
A print(Colour.purple + Highlight.yellow + "End"
B print(Colour.blue + Highlight.grey + Style.bold + "Start")
C print(Colour.green + Style.underline + "Middle")
Question 4
A print(Colour.red + Highlight.white + "Alert")
B print(Style.bold + Colour."blue" + "Notice")
C print(Highlight.green + Style.italic + "Info")
Question 5
A print(Colour.orange + Highlight.grey + Style.bold + "Loading")
B print(COLOUR.red + Highlight.pink + "Error")
C print(Highlight.gold + Style.underline + "Complete")

Answer Key

Combining Colour, Highlight and Style
Section A: Quick Questions
Q1
B — True
Q2
A — +
Q3
A — No, any order works
Q4
B — True
Q5
A — True
Section B: Match the Pairs
Q1
print(Colour.red + Highlight.yellow + Style.bold + "Go!") → Displays bold red text with a yellow highlight
Q2
print(Colour.blue + Style.italic + "Stop!") → Displays italic blue text with no highlight
Q3
Joining multiple dot-notation values with + before the string → Combining Colour, Highlight and Style
Q4
The symbol used to chain each effect together, including the final string → +
Q5
print(Colour.blue, Style.italic + "Stop!") → Combined effects should be joined with +, not a comma
Q6
print(Colour.red + style.bold + "Danger") → Style should start with an uppercase S, not lowercase style
Section C: Definitions
Q1
Colour.red + Highlight.yellow + Style.bold — Joining multiple dot-notation values together with + to apply colour, highlight, and style all at once
Section D: Fill in the Blanks
Q1
print(Colour.red + Highlight.yellow + Style.bold + "Level up!")
Q2
print(Colour.red + Highlight.yellow + Style.bold + "Level up!")
Q3
print(Colour.blue + Style.italic + "Warning!")
Q4
print(Colour.green + Highlight.pink + Style.underline + "Great job!")
Q5
print(Colour.gold + Style.bold + "Score: 100")
Section E: Spot the Error
Q1
A — Combined effects should be joined with +, not a comma — it should read Colour.blue + Style.italic.
Q2
A — Style must start with a capital S, not lowercase style — it should read Style.bold.
Q3
A — This line is missing its closing bracket — it should read print(Colour.purple + Highlight.yellow + "End").
Q4
B — Colour values are not written in quotation marks — it should read Colour.blue.
Q5
B — Only the first letter of Colour should be capitalised — it should read Colour.red, not COLOUR.red.