Home assignment 1#

Last updated: 2023-02-25 13:41:13

Question 1#

  • Find out how many cities in Israel are documented in the world_cities.csv file.

  • Use encoding="utf-8" when reading the file.

  • Hint: use a conditional and a counter variable inside a for loop, to count the number of rows where the value of the "country" column is "Israel".

193

Question 2#

  • The stops.txt file lists public transport stations in Israel, and includes the following columns:

    • stop_id—Stop ID

    • stop_name—Stop name

    • stop_lon—Stop longitude

    • stop_lat—Stop latitude

  • Using these four columns in the stops.txt file, find the IDs and names of all bus stops within a radius of 500 \(m\) around the Department of Geography at the Ben-Gurion University (34.800124,31.262794), collect them into a list of (stop_id,stop_name) tuples, and then print the list.

  • Use the distance function definition from Example: distance function to calculate the distances between each station and the Department of Geography.

  • Hint: use a conditional to append the corresponding station name to the list of results if the distance is smaller than 500.

[('25750', 'רינגלבלום/יעבץ'),
 ('26119', 'רינגלבלום/יוסף בן מתתיהו'),
 ('26120', 'יצחק רגר/יוסף בן מתתיהו'),
 ('26130', 'אוניברסיטת בן גוריון/יצחק רגר'),
 ('26496', 'מרפאות חוץ סורוקה/אוניברסיטת בן גוריון'),
 ('26665', 'מרכז רפואי סורוקה/בן גוריון'),
 ('26669', 'מרפאות חוץ סורוקה/אוניברסיטת בן גוריון'),
 ('27622', 'מרכז רפואי סורוקה/אוניברסיטת בן גוריון'),
 ('27623', 'מרכז רפואי סורוקה/אוניברסיטת בן גוריון'),
 ('28927', 'כיכר האבות/יעקב אבינו'),
 ('28928', 'יעקב אבינו/אלכסנדר ינאי'),
 ('43127', 'אוניברסיטת בן גוריון/יצחק רגר')]