if the number of modes is or greater than the maximum modes that are acceptablea mode of none is returnedotherwisea sorted list of the modes is returned def calculate_median(numbers)numbers sorted(numbersmiddle len(numbers/ median numbers[middleif len(numbers = median (median numbers[middle ] return median the median ("middle value"is the value that occurs in the middle if the numbers are arranged in order--except when the number of numbers is evenin which case the middle falls between two numbersso in that case the median is the mean of the two middle numbers we begin by sorting the numbers into ascending order then we use truncating (integerdivision to find the index position of the middle numberwhich we extract and store as the median if the number of numbers is evenwe make the median the mean of the two middle numbers def calculate_std_dev(numbersmean)total for number in numberstotal +((number mean* variance total (len(numbers return math sqrt(variancethe sample standard deviation is measure of dispersionthat ishow far the numbers differ from the mean this function calculates the sample standard - deviation using the formula (xn -- xwhere is each number- is the meanand is the number of numbers def print_results(countstatistics)real " fif statistics mode is nonemodeline "elif len(statistics mode= modeline "mode { :{fmt}}\nformatstatistics mode[ ]fmt=realelsemodeline ("mode ["join(["{ }format(mfor in statistics mode]"]\ "print("""