Psst! Check what courses we have in our offer, and get them all here to save $727. Tick-tock—this deal ends on 3/21.
10. Datetime arithmetic


Good job! We can find the difference between two datetime objects, just as we did with date objects:

fra_mad_actual = datetime.datetime(2018, 12, 1, 9, 45, 0)
now =
timedelta = now - fra_mad_actual
print('Time since my FRA-MAD flight:', timedelta)

The resulting string will differ based on the moment when you execute the code.


Write a function named starts_in(start_datetime). The function should accept a datetime and return a timedelta that shows how much time is left until the meeting starts. In your solution, assume that start_datetime is in the future, never in the past.

Stuck? Here's a hint!

Inside the function, define a variable named now:

now =

Then, calculate the time difference between start_datetime and now.