[['Albania', 'Tirana', '41.3289', '19.8178'],
['Andorra', 'Andorra la Vella', '42.5000', '1.5000'],
['Austria', 'Vienna', '48.2000', '16.3667'],
['Belarus', 'Minsk', '53.9000', '27.5667'],
['Belgium', 'Brussels', '50.8500', '4.3500'],
['Bosnia and Herzegovina', 'Sarajevo', '43.8667', '18.4167'],
['Bulgaria', 'Sofia', '42.7000', '23.3300'],
['Croatia', 'Zagreb', '45.8167', '15.9833'],
['Czech Republic', 'Prague', '50.0833', '14.4167'],
['Denmark', 'Copenhagen', '55.6761', '12.5683'],
['Estonia', 'Tallinn', '59.4372', '24.7453'],
['Finland', 'Helsinki', '60.1708', '24.9375'],
['France', 'Paris', '48.8567', '2.3508'],...]
From the foregoing, I want to find the most eastern and northern cities. Therefore, I want to make out the maximum longitude or latitude and return the city and country. The following is my first effort, which obviously does not work, because I do not understand how to approach the problem. I'm 66, not homework, just trying to figure out if my brain works! Thanks for any help
def find_city():
from operator import itemgetter
eu_list=[]
EU =['Austria','Belgium', 'Bulgaria','Czech Republic', 'Croatia', 'Cyprus','Denmark', 'Estonia', 'France', 'Finland', 'Germany', 'Hungary','Ireland', 'Italy', 'Luxembourg', 'Latvia', 'Lithuania', 'Malta','Netherlands', 'Portugal', 'Poland', 'Romania', 'Spain', 'Sweden','Slovakia', 'Slovenia','United Kingdom']
countrylist =parse_doc()
for item in countrylist:
country = item[0]
capital = item[1]
latitude = item[2]
longitude = item[3]
if country in EU:
eu_list.append(item)
result = sorted(eu_list,key=lambda x: x[3], reverse=True)[3]
result1= sorted(eu_list,key=lambda x: x[3], reverse=True)[2]
print("{} in {} is the most eastern city in the EU".format(result[1], result[0]))
print("{} in {} is the northern-most city in the EU".format(result1[1], result1[0]))