# 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
list = [6, 8, 12, 14]
stat.stdev ( list)
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_array = np.array (temps)
print (stat.mean (temps_array))
print (stat.median ( temps_array))
print (stat.mode (temps_array ))
print (stat.variance(temps_array))
print (format (stat.stdev(temps_array), ".3f"))
temps = [45, 51, 38, 42, 47, 51, 52, 55, 48, 43]
n = len(temps)
days = np.linspace(1,n,n)
x_axis = days
y_temp = temps_array
mean = (stat.mean (temps_array))
y_mean = ((np.ones (len (temps)))* mean)
sdev = (format (stat.stdev(temps_array), ".3f"))
plt.plot (x_axis, y_temp, "rx")
plt.plot (x_axis, y_mean, "g")
y_sdev = ((np.ones (len (temps)))* sdev)
y_SD = np.array ((format (stat.stdev(temps_array), ".3f"))* (np.ones (len (temps))))
plt.plot (x_axis, y_SD, "--b")
# Plot the temperatures vs the days as a scatter plot using a red "x"
#
# Plot the mean as a horizontal line in green
#
# Illustrate 1 standard deviation away from the mean by drawing two horizonal lines in
# as dotted blue lines
plt.show()
import random
n = 15
for x in range (0, n):
print (random.randint(100, 200))
import numpy as np
print (np.random.randint (low= 100, high= 200, size= 15))
n = 15
for x in range (0,n):
print (random.random ())
print (np.random.uniform (size= 15))
for i in range (0, 16):
x = random.random ()
y = 10 + 30 * x
print (y)
x = np.random.uniform (size= 15)
y = 10 + 30 * x
print (y)
x = np.random.normal (size= 15)
print (x)
y = 20 + x*(0.5)
print (y)