🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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")
  1. A.Weekday
  2. B.Sat
  3. C.Nothing
  4. 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 →