# import statistics library as stat
#
import statistics as stat
#
# import matplotlib.pyplot as plt and NumPy as np
import matplotlib.pyplot as plt
import numpy as np
temps = [45, 51, 38, 42, 47, 51, 52, 55, 48, 43]
n = len(temps)
# for plotting purposes I have added an array of days from 1 to 10
days = np.linspace(1,n,n)
temps_mean = stat.mean(temps)
temps_median = stat.median(temps)
temps_mode = stat.mode(temps)
temps_var = round(stat.variance(temps), 3)
temps_stdev = round(stat.stdev(temps), 3)
print(f"Mean: {temps_mean} Median: {temps_median} Mode: {temps_mode} \nVariation: {temps_var} Std.Deviation: {temps_stdev}")
# Plot the temperatures vs the days as a scatter plot using a red "x"
plt.plot(temps, 'rx')
#
# Plot the mean as a horizontal line in green
mean_line = np.linspace(temps_mean, temps_mean, n)
plt.plot(mean_line,'--g')
#
# Illustrate 1 standard deviation away from the mean by drawing two horizonal lines in
# as dotted blue lines
upper_stdev = np.linspace(temps_mean + temps_stdev, temps_mean + temps_stdev, n)
lower_stdev = np.linspace(temps_mean - temps_stdev, temps_mean - temps_stdev, n)
plt.plot(upper_stdev, '--b')
plt.plot(lower_stdev, '--b')
plt.show()
from numpy import random
intlist = []
for i in range (0, 15):
x = random.randint(100, 200)
intlist.append(x)
print(f"{intlist}")
floatlist = []
for i in range (0, 15):
x = random.rand()
floatlist.append(x)
print(f"{floatlist}")
floatlist2 = []
for i in range (0, 15):
x = random.uniform(10, 40)
floatlist2.append(x)
print(f"{floatlist2}")
floatlist3 = []
for i in range (0, 15):
x = random.randn()
floatlist3.append(x)
print(f"{floatlist3}")
floatlist4 = []
for i in range (0, 15):
x = random.normal(20, 0.5)
floatlist4.append(x)
print(f"{floatlist4}")