print() with Style.

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

print() with Style.

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does Style. change the text style of the displayed text?
A True
B False
2. Should the style name after the dot be written in quotation marks?
A True
B False
3. Should Style start with an uppercase or lowercase S?
A Uppercase
B Lowercase
4. Should Style.bold be joined to a string with + or a comma?
A Comma
B +
5. Is STYLE written fully in uppercase valid in this system?
A False
B True

Match the Pairs

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

Left columnRight column
1print(Style.bold + "Level up!") ADisplays the text in bold
2print(Style.italic + "Warning!") BStyle.
3A value joined with + to a string to change its text style CStyle.underline
4The word after the dot specifying which style to use DThe style name should not be written in quotation marks
5print(style.bold + "Warning!") EDisplays the text in italics
6print(Style."italic" + "Game Over") FStyle should start with an uppercase S, not lowercase style

Definitions

Style.bold

Fill in the Blanks

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

1.
print(_____.bold + "Level up!")
2.
print(Style.______ + "Warning!")
3.
print(Style.____ + "Great job!")
4.
_____(Style.underline + "Score: 100")
5.
print(Style._________ + "Bye!")

Spot the Error

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

Question 1
A style.bold used in this line
B print(Style.italic + "Hello!")
C print(Style.underline + "Great!")
Question 2
A print(Style.bold + "Level up!")
B print(Style."italic" + "Game Over")
C print(Style.underline + "Success")
Question 3
A print(Style.bold + "Start")
B print(Style.italic + "Middle")
C print(Style.underline + "End"
Question 4
A print(Style.bold, "Set")
B print(Style.italic + "Ready")
C print(Style.underline + "Go")
Question 5
A print(Style.bold + "Loading...")
B print(STYLE.italic + "Error")
C print(Style.underline + "Complete")

Answer Key

print() with Style.
Section A: Quick Questions
Q1
A — True
Q2
B — False
Q3
A — Uppercase
Q4
B — +
Q5
A — False
Section B: Match the Pairs
Q1
print(Style.bold + "Level up!") → Displays the text in bold
Q2
print(Style.italic + "Warning!") → Displays the text in italics
Q3
A value joined with + to a string to change its text style → Style.
Q4
The word after the dot specifying which style to use → Style.underline
Q5
print(style.bold + "Warning!") → Style should start with an uppercase S, not lowercase style
Q6
print(Style."italic" + "Game Over") → The style name should not be written in quotation marks
Section C: Definitions
Q1
Style.bold — A value joined to a string with + inside print() to change the text style of the displayed text
Section D: Fill in the Blanks
Q1
print(Style.bold + "Level up!")
Q2
print(Style.italic + "Warning!")
Q3
print(Style.bold + "Great job!")
Q4
print(Style.underline + "Score: 100")
Q5
print(Style.underline + "Bye!")
Section E: Spot the Error
Q1
A — Style must start with a capital S, not lowercase style.
Q2
B — Style values are not written in quotation marks — it should read Style.italic.
Q3
C — This line is missing its closing bracket — it should read print(Style.underline + "End").
Q4
A — Style and the string should be joined with +, not a comma — it should read Style.bold + "Set".
Q5
B — Only the first letter of Style should be capitalised — it should read Style.italic, not STYLE.italic.