Objective
Create a Python program that computes how many days there are between two dates using the datetime module. Subtracting two dates gives a timedelta object.
Instructions
- Read two lines, each with a date in
YYYY-MM-DDformat (year-month-day). Convert them withdate.fromisoformat. - Show
Days: dwith the result of subtracting the first date from the second (it can be negative if the second one is earlier). - Also show
Full weeks: s and r days, computed with the absolute value of the days anddivmod.
2026-03-01
2026-03-20
Days: 19
Full weeks: 2 and 5 days
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise