Login and get coding
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_lonfunction 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=jsonand the output language
Due to limitations of API calls (max. one call per second), we stored the required requests in the
nominatim_responses.jsonfile. The JSON file holds the query url as the
keyto 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_planfunction. 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_distancefunction which takes your journey from the
create_travel_planfunction 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
Good luck and keep calm and see you at the next PyCon events! :)
56 out of 56 users completed this Bite.
Will you be Pythonista #57 to crack this Bite?
Resolution time: ~64 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 4.8 on a 1-10 difficulty scale.
» Up for a challenge? 💪