Question: The below explanations cover all steps that are required to perform the calculations for each function. However, some of those steps are already been implemented

The below explanations cover all steps that are required to perform the calculations for each function. However, some of those steps are already been implemented for you. Please fill in only the steps that are left incomplete.Instructions1. Function Definitions: You are provided with four incomplete functions in the codecalculate_mean(numbers): calculate the mean (average) of a list of numbers.calculate_median(numbers): calculate the median (middle number) of a list of numbers.calculate_standard_deviation(numbers): calculate the standard deviation of a list of numbers.read_file(file_name): read the file, put numbers in the file to a list, and return the list containing numbers.main(): execute all functions and present results.Your task is to complete these functions by filling in the missing code. Do not use hard-coded values; instead, use Python code to perform the calculations. Also, you should not use any built-in functions for mean, median, and standard deviation. You should develop those functions from scratch based on the skeleton code.2. Mean Calculation (calculate_mean(numbers) function):Find the sum of all the numbers in the numbers list and store it in the variable sum_numbers.Find the length of the numbers list and store it in the variable length_numbers.Calculate the mean using the formula: mean = sum_numbers / length_numbers.Round the mean to two decimal places using the round function.Return the calculated mean to two decimal places.3. Median Calculation (calculate_median(numbers) function):Sort the numbers list in ascending order and store it in the variable sorted_numbers.Find the length of the numbers list and store it in the variable length_numbers.Calculate the index of the middle number in the sorted_numbers list and store it in the variable middle_index. In other words, divide the length of the numbers and round it down. For instance, 4 will be the mid index when there are 8 numbers, and 5 will be the mid index when there are 11 numbers. You can use the floor function from the math library.If the length of the list is even (i.e., length_numbers %2==0), calculate the median using the formula: (sorted_numbers[middle_index -1]+ sorted_numbers[middle_index])/2.If the length of the list is odd, simply return the middle number sorted_numbers[middle_index].4. Standard Deviation Calculation (calculate_standard_deviation(numbers)):Calculate the mean of the numbers list by calling the calculate_mean(numbers) function and storing the result in the variable numbers_mean.Find the length of the numbers list and store it in the variable length_numbers.Initialize a variable sum_of_squared_distance to 0.Iterate through each number in the numbers list:Calculate the distance of the current number to the mean (distance).Calculate the square of the distance (squared_distance).Add the squared distance to sum_of_squared_distance.Calculate the standard deviation using the formula: std_dev =(sum_of_squared_distance /(length_numbers -1))**(1/2).Round the standard deviation to two decimal places using the round function.Return the calculated standard deviation.5. File Processing (read_file(file_name)):Read the file given as an argument to the function.Read each line of the file and convert them to floating numbers.Put numbers in the file to a list (by using the append method).Return the list containing numbers.****PLEASE UTILIZE THE BELOW SKELETON CODE BY FILLING IN THE MISSING CODE:def calculate_mean(numbers): # do not use hard-coded values; only code. sum_numbers = # find the sum of the "numbers" list.` length_numbers = # find the length of the "numbers" list. mean = sum_numbers / length_numbers return round(mean,2)def calculate_median(numbers): # do not use hard-coded values; only code. sorted_numbers = # sort the numbers list ascendingly. length_numbers = # find the length of the "numbers" list. middle_index = math.floor() # find the index of the middle number in the "sorted_numbers" list. if length_numbers %2==0: return (sorted_numbers[middle_index -1]+ sorted_numbers[middle_index])/2 else: # return the middle number from the "sorted_numbers" list. def calculate_standard_deviation(numbers): # do not use hard-coded values; only code. # requires to complete "calculate_mean" function numbers_mean = calculate_mean(numbers) length_numbers = # find the length of the "numbers" list. sum_of_squared_distance =0 for number in numbers: distance = # calculate the distance of "number" to the mean i.e. "numbers_mean" squared_distance = # calculate the square of "distance" sum_of_squared_distance += squared_distance std_dev =(sum_of_squared_distances /(length_numbers -1))**(1/2) return round(std_dev, 2)def read_file(file_name): numbers = list() # an empty list where all numbers from the file will be stored. # Read the file given as an argument to the function. # Read each line of the file, convert them to floating numbers, and put numbers in the file to the "numbers" list (by using the append method). # Return the list containing numbers.def main(): file_name = input("Please enter the name of the input data file:") numbers = read_file(file_name) mean = calculate_mean(numbers) median = calculate_median(numbers) sd = calculate_standard_deviation(numbers) ## Present the results like the sample outputmain()
****PLEASE WRITE THE FOLLOWING PROGRAM USING PYTHON AND INCLUDE A SAMPLE INPUT AND OUTPUT, THANK YOU!****

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!