easy +10 pts

Weekday from date

Determine the day of the week for any given date in YYYY-MM-DD format.

Write a function `get_weekday(date_str: str) -> str` that takes a string in the format `'YYYY-MM-DD'` representing a valid Gregorian calendar date (year >= 1) and returns the full English name of the day of the week, e.g. `'Monday'`, `'Tuesday'`, etc. The date is always valid and is in the proleptic Gregorian calendar (the standard datetime module convention). The result must match Python's `datetime` weekday naming (Monday = 0).

Constraints

The input string is always non-empty, in the exact format `YYYY-MM-DD`, and represents a valid date in the proleptic Gregorian calendar. Year is between 1 and 9999. Your solution should run in O(1) time per call.

Example

>>> get_weekday('2023-10-09')
'Monday'
>>> get_weekday('2024-02-29')
'Thursday'
>>> get_weekday('2000-01-01')
'Saturday'
10 points ~10 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Use Python's built-in `datetime.date` and its `weekday()` method.
The `weekday()` method returns 0 for Monday, 1 for Tuesday, etc.
Map the integer result to a list of weekday names.
Parse the input string with `datetime.strptime` or by splitting into parts.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.