Avg_Temps = [17, 18, 29, 43, 55, 65, 70, 68, 59, 48, 37, 22] avg_temp = sum(Avg_Temps) / len(Avg_Temps) print(f"Average Temp: {avg_temp}") TotalFatalCrashes = [297, 280, 267, 350, 328, 386, 419, 410, 331, 356, 326, 311] total_fatal_crashes = sum(TotalFatalCrashes) print(f"Total Fatal Crashes: {total_fatal_crashes}") average_number_of_fatal_crashes = total_fatal_crashes / len(TotalFatalCrashes) print(f"Average Number of Fatal Crashes: {average_number_of_fatal_crashes}") temp_dev = [] for Avg_Temp in Avg_Temps: temp_dev.append(Avg_Temp - avg_temp) crash_dev = [] for TotalFatalCrash in TotalFatalCrashes: crash_dev.append(TotalFatalCrash - average_number_of_fatal_crashes) slope_numerator = 0 for values in zip(temp_dev, crash_dev): slope_numerator += (values[0] * values[1]) print(f"slope numerator value: {slope_numerator}") slope_denominator = 0 for temp in temp_dev: slope_denominator += (temp * temp) print(f"slope denominator: {slope_denominator}") slope = slope_numerator / slope_denominator print(f"Slope: {slope}") a = average_number_of_fatal_crashes - slope*avg_temp print(f"a is {a}") print(f"Regression: {slope}x + {a}")