0

I'm trying to determine the names of the boroughs with the highest/lowest populations and population densities and the largest/smallest areas. This is a screenshot of my table.

I am able to print these values on their own but don't know how to determine the names of the boroughs they correspond to.

maxpop = table.population.max
minpop = table.population.min
maxden = table.density.max
minden = table.density.min
maxar = table.area.max
minar = table.area.min

for item in table:
     if int(item['population']) == int(maxpop):
          result = item['name']
print(result)

I then get a TypeError because 'string indices must be integers.' But I don't even know if this is the right way to go about it? Please help!!

kaeli
  • 1
  • 2

0 Answers0