Dates and times · 7 / 15 Exercise Easy

Day of the week

Objective

Create a Python program that tells which day of the week each date falls on. The weekday() method returns a number: 0 for Monday, 1 for Tuesday... 6 for Sunday.

Instructions

  • Read an integer n and then n dates, one per line, in YYYY-MM-DD format.
  • Store the day names in a list (starting with Monday, capitalized: Monday, Wednesday...) and use it with the result of weekday().
  • For each date show YYYY-MM-DD: day.
Input
3
2026-11-14
2026-01-01
2024-02-29
Output
2026-11-14: Saturday
2026-01-01: Thursday
2024-02-29: Thursday

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise