### added exercise solutions

parent 0820e4c9
 import matplotlib.pyplot as plt # data mutant = [1, 3, 2, 1, 5, 7, 3, 5] control = [6, 7, 1, 8, 3, 7, 8, 6] # draw a box plot data = [mutant, control] fig1, ax1 = plt.subplots() ax1.set_title('Basic Plot') ax1.boxplot(data) plt.show() \ No newline at end of file
 measurements = [1, 7, 3, 4, 0, 5, 4, 2, 8, 7] # determine sum of all measurements sum = 0 for number in measurements: sum = sum + number # determine mean of all measurements number_of_measurements = len(measurements) mean = sum / number_of_measurements print("Mean: " + str(mean)) # go through measurements again and calculate standard deviation squared_sum = 0 for number in measurements: squared_sum += pow(number - mean, 2) / number_of_measurements from math import sqrt standard_deviation = sqrt(squared_sum) print("Standard deviation: " + str(standard_deviation)) \ No newline at end of file
 measurements = [1, 7, 3, 4, 0, 5, 4, 2, 8, 7] import numpy as np minimum = np.min(measurements) print("Mean: " + str(minimum)) maximum = np.max(measurements) print("Mean: " + str(maximum)) mean = np.mean(measurements) print("Median: " + str(mean)) median = np.median(measurements) print("Mean: " + str(median)) standard_deviation = np.std(measurements) print("Standard deviation: " + str(standard_deviation)) \ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment