GH avatar Bite 261. Visit all PyCons in Europe

In Bite 256 you scraped data on 2019 PyCons. Now it's time to go there! In this Bite you enrich the data with geographical information and create a travel plan to visit all the PyCons! This will involve using some data from an geographical information API.

First you have to collect the rough geographical location data for the different PyCons. An excellent source for such data is OpenStreetMaps. You will use data from the Nominatim API to complete the update_pycons_lat_lon function which updates the PyCon data with latitude and longitude of the corresponding city.

For example, if you want to get information on Munich you can use this query which asks for the city and country q=Munich,Germany, the format &format=json and the output language &accept-language=en.

Due to limitations of API calls (max. one call per second), we stored the required requests in the nominatim_responses.json file. The JSON file holds the query url as the key to the response data (nested dict). If you are interested in details on the online API see the this page.

After you retrieved and updated the information, plan your journey by completing the create_travel_plan function. Here you want to bring the PyCons in the right order as you won't be able to visit PyCons that lie in the past :) For ordering assume it's now the start of 2019.

Finally, complete the total_travel_distance function which takes your journey from the create_travel_plan function and returns the total distance you traveled for the complete PyCon journey. For simplicity, only consider the air distance in kilometers between the PyCons using the helper function _km_distance.

Good luck and keep calm and see you at the next PyCon events! :)

Login and get coding
go back Intermediate level
Bitecoin 3X

27 out of 28 users completed this Bite.
Will you be Pythonista #28 to crack this Bite?
Resolution time: ~69 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 4.8 on a 1-10 difficulty scale.
» Up for a challenge? 💪

We use Python 3.8