GH avatar Bite 175. Find missing dates

Complete get_misssing_dates that takes an (unordered) sequence of datetime.date objects. It should determine what the start and end date of this sequence is and return the missing dates.

Here is an example (horizontal scroll code below):

>>> from datetime import date
>>> from missing_dates import get_misssing_dates
>>> date_range = [date(year=2019, month=2, day=n) for n in range(1, 11, 2)]
>>> date_range
[datetime.date(2019, 2, 1), datetime.date(2019, 2, 3), datetime.date(2019, 2, 5), datetime.date(2019, 2, 7), datetime.date(2019, 2, 9)]

# our function returns the missing dates
# = the ones that were not generated in the preceding code
>>> sorted(get_misssing_dates(date_range))
[datetime.date(2019, 2, 2), datetime.date(2019, 2, 4), datetime.date(2019, 2, 6), datetime.date(2019, 2, 8)]

Some modules make this fairly easy (hint hint).

Thanks @shravankumar147 for sharing this idea on Twitter last week :)

Good luck and keep calm and code in Python!

Note that our pandas Bites currently run on Python 3.6.

21 out of 23 users completed this Bite.
Will you be Pythonista #22 to crack this Bite?
It takes an average of ~29 minutes to solve this Bite (submissions 5-240 min).
Pythonistas rate this Bite 2.0 on a 1-10 difficulty scale.
» You can do it! 😌

Buy Now Login and get coding
We use Python 3.7