Add Answer Options
Show four numbered choices below the question
💻
Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.
The player needs choices
A question on its own is not a quiz — the player needs answer options to choose from. Each question in PyQuiz shows four numbered choices:
What is the type of the value 3.14?
1) int
2) str
3) float
4) boolYou already know how to print one line. To print a list of options, call print() once for each:
print(" 1) apple")
print(" 2) banana")The two spaces at the start of each line indent the options. This makes them stand out visually under the question.
Instructions
Add four answer options below the question.
- Call
print()with no arguments to add a blank line between the question and the options. - Print the four options, each on its own line with two spaces of indentation:
1) int2) str3) float4) bool
# Display the quiz title and question
print("=== Python Quiz ===")
print()
print("What is the type of the value 3.14?")
# Step 1: Print a blank line
# Step 2: Print the four options
Interactive Code Editor
Sign in to write and run code, track your progress, and unlock all chapters.
Sign In to Start Coding