Log in to save your progress.
<< Back to problems
OBS! Fönstret är för smalt för att använda pythonlabbet.se. Använd en enhet med tangentbord!

Determine weekday

Prerequisites: Basic course part 2

Determine which weekday it is based on a date in the format yyyy-mm-dd. The program should handle all dates from 1900-01-01 up to and including 2100-01-01. Gold star if your program can handle a larger interval ⭐!

Print Invalid if the date does not exist.

Keep in mind that it is a leap year every four years. Exceptions to every four years apply to years divisible by 100. There is in turn an exception to that rule if the year is divisible by 400. Therefore, for example, the years 1600 and 2000 are leap years, even though they are divisible by 100.

Example input 1

2022-12-13

Example output 1

Tuesday

Example input 2

1983-08-18

Example output 2

Thursday

Example input 3

2050-01-01

Example output 3

Saturday

Example input 4

1900-01-01

Example output 4

Monday

Example input 5

2023-02-29

Example output 5

Invalid

Example input 6

2023-09-31

Example output 6

Invalid

Login to save your progress and your code.

Create

Write your code here.

-- Output from your program will be here --