Note: Please only use python standard libraries (i.e. json, csv etc). Numpy and pandas are allowed in this assignment.

1 answer below »
Please see assignment instructions in a word document


Note: Please only use python standard libraries (i.e. json, csv etc). Numpy and pandas are allowed in this assignment.
Answered Same DayApr 29, 2021

Answer To: Note: Please only use python standard libraries (i.e. json, csv etc). Numpy and pandas are allowed...

Harsimran answered on Apr 30 2021
146 Votes
import csv
import numpy as np
from operator import itemgetter

a1 =[]
cities = []
elevation_list =[]
populati
on_list =[]
with open('./cities.csv') as csv_file:
csv_reader = csv.reader(csv_file)
line_count = 0
water_area = 0
maximum_area= 0
minimum_area = 5000
total_area = 0
land_area = 0
for row in csv_reader:
if line_count == 0:
line_count += 1
else:
line_count += 1
if(len(row[9]) != 0):
try:
area = int(row[9])
except ValueError:
area = float(row[9])
if(minimum_area > area):
minimum_area = area
name_min = row[0]
if(maximum_area < area):
maximum_area = area
name_max = row[0]
total_area += area



if(len(row[11]) != 0):
try:
water_area = int(row[11])
except ValueError:
water_area= float(row[11])
water_area +=...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here