You're an intern at a rapidly growing tech start-up. They've recently developed a web application for data analysis, and a crucial part of it is calculating statistics. As they've been growing, the application's code base has become quite large, and it's time to start organizing things better. Your task for the week is to create a Python module called statistics_calculator that contains functions to calculate the mean, median, mode, and standard deviation of a list of numbers.
You should structure your code as follows: Create separate files for each of the statistics, with their respective calculation function. These files should be:
  • Contains a function calculate_mean to calculate the mean.
  • Contains a function calculate_median to calculate the median.
  • Contains a function calculate_mode to calculate the mode (in case there are several most frequent numbers the function should return the smallest one).
  • Contains a function calculate_std_dev to calculate the standard deviation.
Each of these files should be within a directory named statistics_calculator. Finally, import all these functions in the statistics_calculator/ file so that other parts of the application can access these functions without additional imports.
The input and output are handled automatically by the module.
Your code structure should look like this:
a=[2, 2, 3, 5, 7, 5, 7, 5, 2, 2]; print(calculate_mean(a)); print(calculate_median(a)); print(calculate_mode(a)); print(calculate_std_dev(a))
4.0 4.0 2 2.05480467


Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue