永发信息网

python问题

答案:1  悬赏:30  手机版
解决时间 2021-04-21 00:37
  • 提问者网友:留有余香
  • 2021-04-20 15:49

load_airports(reader)



Given an open reader that contains airport data in the format described above this table, return a tuple that contains two dictionaries and a list.

The first dictionary should contain three-letter airport codes (of type str) as keys and tuples with two elements as values. Each tuple should contain the city the airport is associated with (str) as the first value and a tuple containing its latitude (float) and longitude (float) as the second value.

The latitude and longitude tuple should be obtained by providing the name of the airport followed by the word CANADA to the geocode function of the maps module. If the maps module cannot provide the latitude and longitude of the airport, the airport should not be placed in this dictionary.

The second dictionary should also use three-letter airport codes as keys. An airport should only be represented in this dictionary if it has US or international flights. If an airport has US flights (but no international flights), its value in the dictionary should be the str "US". If it has international flights, its value should be the str "INT". Again, if the maps module cannot provide the latitude and longitude of the airport, the airport should not be placed in this dictionary.

The list should contain the three-letter codes of all airports that the geocode function (which uses Google's geocoding service) cannot locate.


DEER LAKE:YDF:DEER LAKE
EDMONTON INTERNATIONAL:YEG:EDMONTON:US
FREDERICTON:YFC:FREDERICTON
HALIFAX INTERNATIONAL:YHZ:HALIFAX:INT
MONTREAL INTERNATIONAL MIRABEL:YMX:MONTREAL:INT
OLD CROW:YOC:OLD CROW
WINDSOR:YQG:WINDSOR
REGINA INTERNATIONAL:YQR:REGINA:US
THUNDER BAY:YQT:THUNDER BAY
VANCOUVER INTERNATIONAL:YVR:VANCOUVER:INT
MONT JOLI:YYY:MONT JOLI
LESTER B PEARSON INTERNATIONAL:YYZ:TORONTO:INT


最佳答案
  • 五星知识达人网友:撞了怀
  • 2021-04-20 16:57

你想知道什么?


我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯