Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

# Load the numbers from a file into an array. def load_numbers(filename): number

ID: 3759761 • Letter: #

Question

# Load the numbers from a file into an array.
def load_numbers(filename):

    numbers = [] # to hold the list of numbers

    try:
        number_file = open(filename, "r")
        for number in number_file:
            number = int(number) # Convert the read string to an int.
            numbers.append(number)
    except Exception as err:
        print ("An error occurred loading", filename)
        print ("The error returned was", err)
        return numbers

    if (len(numbers) < 1):
        print ("There were no numbers in", filename)
        return numbers

    else:
        return numbers

# Perform the statistics calculations using the values
# in the numbers array.
def calculate_stats(numbers):


# The main function that contains what the program is to do!
def main():
    do_evaluate = True
    while(do_evaluate):
        filename = input(' What is the file you would like to evaluate? ')
        numbers = load_numbers(filename)
        if (len(numbers) > 0):
            calculate_stats(numbers)
        check_evaluate = input(' Would you like to evaluate another file? (y/n) ')
        if (check_evaluate != 'y'):
            do_evaluate = False


# Call the main() function to make the program do what it is defined to do.
main()

The code you write Ecalculate stuts is to do the fellowing using the functions provided in the Pyth in statistics module and the data presented in the numers atrRy . Calculate the ean . Calculate the median. Calculate the median Jow Calculate the median-high Calculate the median gromped low. Calculate the stdev Caleulate the stdev Calculate the varlance Present the above values to the user using the following before each median low median hich median gropeds

Explanation / Answer

def main():
do_evaluate = True
while(do_evaluate):
filename = input(' What is the file you would like to evaluate? ')
numbers = load_numbers(filename)
if (len(numbers) > 0):
calculate_stats(numbers)
check_evaluate = input(' Would you like to evaluate another file? (y/n) ')
if (check_evaluate != 'y'):
do_evaluate = False