import statisticsSolver def main(): total = 0 counter = 1950 high_temp = [] low_temp = [] high_year = [] low_year = [] temperatures = [] avg = statisticsSolver.mean(temperatures) stdev = statisticsSolver.stdev(temperatures) stdev_upper = avg + (2 * stdev) stdev_lower = avg - (2 * stdev) temp_file = open("Project2Temps.txt", "r") for temps in temp_file: temperatures.append(int(temps)) for year in counter: year = counter + 1 while total < len(temperatures): temperatures[total] = temperatures[total].rstrip("\n") total += 1 for temps in temperatures: if temps > stdev_upper: high_temp.append(int(temps)) high_temp.append(int(temps)) for temps in temperatures: if temps < stdev_lower: low_temp.append(int(temps)) low_temp.append(int(temps)) temp_average = statisticsSolver.mean(temperatures) print("This is the average of the tempteratures:", temperatures) stdev_temperature = statisticsSolver.stdev(temperatures) print("the Standard deviation is:", stdev_temperature) main()

import math def mean(temperatures): avg_total = 0 for temp in temperatures: avg_total += int(temp) average = avg_total / len(temperatures) return average def stdev(temperatures): total = 0 total_variance = 0 for item in temperatures: total = total + int(item) avg = total / len(temperatures) for item in temperatures: variance = (int(item) - avg)*(int(item) - avg) total_variance = total_variance + variance denominator = len(temperatures) -1 stdev = math.sqrt(total_variance / denominator) return stdev

I am getting this error upon running the program:

Traceback (most recent call last):

File "P:\COSC 118\Project2\Project2.py", line 41, in <module>

main()

File "P:\COSC 118\Project2\Project2.py", line 14, in main

avg = statisticsSolver.mean(temperatures)

File "P:\COSC 118\Project2\statisticsSolver.py", line 10, in mean

average = avg_total / len(temperatures)

ZeroDivisionerror: division by zero

I have searched for the division by zero error, but I don't completely understand how it relates to my code, thanks.