avatar Bite 276. Get Father's days by date and country

Happy belated Father's day (unless you are in Australia or Scandinavia). 

We pulled some data from the web when Father's day gets celebrated in different countries.

It's a bit messy, but you will help us clean it up.

The goal is to get a dict of keys = dates and values = lists of countries so we can easily generate a report (calendar) of the chronological order in which Father's days will be celebrated across the globe.

First check out the data here and here. One file has the countries by recurring fixed date. The other one by exact date depending the year.

You will parse both files to be able to do the following as best demonstrated in the REPL:

$ python
>>> from fathers_day import get_father_days, generate_father_day_planning
>>> from pprint import pprint as pp
>>> ret = get_father_days()
>>> pp(ret)
{'August 9': ['Samoa', 'Brazil'],
'February 23': ['Russia'],
'June 14': ['U.S.', 'Canada', 'U.K.'],
'June 17': ['El Salvador', 'Guatemala'],
'June 21': ['Egypt', 'Jordan', 'Lebanon', 'Syria', 'Uganda'],
'June 23': ['Nicaragua', 'Poland'],
'June 7': ['Austria', 'Belgium'],
'March 19': ['Andora',
            'Bolivia',
            'Honduras',
            'Italy',
            'Liechtenstein',
            'Portugal',
            'Spain'],
'May 10': ['Romania'],
'May 21': ['Germany'],
'November 8': ['Estonia', 'Finland', 'Iceland', 'Norway', 'Sweden'],
'September 6': ['Fiji', 'New Guinea', 'Australia', 'New Zealand']}
>>> generate_father_day_planning()
February 23
- Russia

March 19
- Andora
- Bolivia
- Honduras
- Italy
- Liechtenstein
- Portugal
- Spain

...
...

November 8
- Estonia
- Finland
- Iceland
- Norway
- Sweden

--

Note that get_father_days uses default year = 2020, but if we give it 2021 or 2022 (see tests), it should equally work.

Have fun and keep calm and code in Python!

Login and get coding
go back Advanced level
Bitecoin 4X

32 out of 33 users completed this Bite.
Will you be the 33rd person to crack this Bite?
Resolution time: ~64 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 5.33 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help