Pybites Logo

Set up future notifications

Level: Intermediate (score: 3)

Let's do another datetime processing Bite. Complete add_todo below that converts time units to future timestamps.

Here is how it works with given default start_time of NOW:

>>> from timer import add_todo, NOW
>>> str(NOW)
'2019-02-06 22:00:00'
>>> add_todo("11h 10m", "Wash my car")
'Wash my car @ 2019-02-07 09:10:00'
>>> add_todo("30d", "Code a Bite")
'Code a Bite @ 2019-03-08 22:00:00'
>>> add_todo("5m 3s", "Go to Bed")
'Go to Bed @ 2019-02-06 22:05:03'

See the docstring and tests for more output examples. Good luck and code more Python!