Intermediate
Days between dates and a local time in UTC
Write days_between(a, b) that takes two ISO dates as text (such as "2026-03-01") and returns the whole number of days from a to b. It is negative when b is earlier.
Write to_utc(text, zone) that takes a local ISO date and time without an offset (such as "2026-07-01T09:00") and a time-zone name (such as "Europe/London") and returns the same moment in UTC as ISO text.
Then print days_between("2026-10-10", "2026-12-25").
What Check tests
days_betweencounts daysdays_betweenis negative going backwards- It handles a leap year
- The same day is 0 days apart
- A zone with a half-hour offset works
- London summer time is one hour ahead of UTC
- New York winter time is five hours behind UTC
- The program prints 76
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.