# lab05.py import numpy as np import matplotlib.pyplot as plt # ----------------------------------------------------- # Computer Science, Lab 05 # May 2022 # Your Name # ----------------------------------------------------- def read_file(name): input_file = open(name, "r") number_buckets = int(input_file.readline()) total_counties = int(input_file.readline()) county_populations = np.zeros([total_counties], dtype="int") for county_number in range(total_counties): line = input_file.readline().split(",") county_populations[county_number] = int(line[1]) county_populations.sort() input_file.close() return number_buckets, county_populations # ----------------------------------------------------- def print_summary(averages): print("Population Grouping Summary") print("---------------------------") for grouping in range(len(averages)): print("Grouping", grouping + 1, "has a population average of", averages[grouping]) # ----------------------------------------------------- # Do not change anything above this line # ----------------------------------------------------- def calculate_averages(number_buckets, county_populations): pass # ----------------------------------------------------- def graph_summary(averages): pass # ----------------------------------------------------- number_buckets, county_populations = read_file("montana-counties.txt") averages = calculate_averages(number_buckets, county_populations) print_summary(averages) graph_summary(averages)