Objective
Create a Python program that adds (or subtracts) a number of days to a date using timedelta, and says which day of the week the result falls on.
Instructions
- Read an integer
nand thennlines with the formatYYYY-MM-DD days(the number of days is an integer, negative to subtract). - Add
timedelta(days=...)to the date and showResult: YYYY-MM-DD (day)with the capitalized day name (as in the previous exercise). - The module takes care of months of different lengths and leap years.
3
2026-01-31 30
2026-03-01 -1
2026-12-31 1
Result: 2026-03-02 (Monday)
Result: 2026-02-28 (Saturday)
Result: 2027-01-01 (Friday)
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise