Find latitude and longitude of first 20 countries with a population greater than or equal to the population limit given below. Use the country details from this dataset.
Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.
Assume radius of earth: 6371 km
Round length of each line and final result to 2 decimal points
If co-ordinates are missing for any country use 0.000 N 0.000 E
Population limit: 2072
import requests
import csv
R = []
countryEligible = []
link = input('Webpage from source: ')
HTMLName = input('Name for html file: ')
reque = requests.get(link, 'html.parser')
with open(HTMLName, 'r') as file:
  file.read(reque.text)
for row in reque.text:
  R.append(row)
input = int(input("Enter the limit of population: "))
countryEligible = []
for i in R:
 if source[i][2] < input:
  countryEligible.append(rows[i])
print(countryEligible)
file.close()
source = []
Comments
Leave a comment