← Quiz: Python Conditions: all 13 questions
Quiz: Python Conditions · Question 13 of 13
What does this print? (code)
What does this print?
day = "Sun"
match day:
case "Sat" | "Sun":
print("Weekend")
case _:
print("Weekday")
- A.Weekday
- B.Sat
- C.Nothing
- D.Weekend
Answer & explanation
Correct answer: Weekend
The | in a case means "or", so "Sun" matches the first case. case _ catches everything else.
Can you get the rest right without peeking?
Take the timed Quiz: Python Conditions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →