# 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]
average = 0
n = len(temps)
days = np.linspace(1,n,n)
print (f'Mean of tempetures is {stat.mean (temps)}')
print (f'Median of temps is {stat.median(temps)}')
print (f'Mode of tempetures is {stat.mode(temps)}')
print (f'Variance of tempetures is {stat.variance (temps)}')
print (f'Standard deviation of tempetures is {stat.stdev(temps)}')
Mean of tempetures is 47.2
Median of temps is 47.5
Mode of tempetures is 51
Variance of tempetures is 27.511111111111113
Standard deviation of tempetures is 5.2451035367389185
# Plot the temperatures vs the days as a scatter plot using a red "x"
x = np.linspace()
#
# 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()
Execution error
TypeError: _linspace_dispatcher() missing 2 required positional arguments: 'start' and 'stop'
x= np.random.randint (low = 100, high = 200, size = 15)
print (x)
[194 164 150 112 193 150 119 130 124 196 193 165 163 110 170]
x= np.random.uniform(size = 15)
print (x)
[0.76944833 0.88251568 0.08270461 0.63414908 0.65026443 0.18427542
0.76127887 0.27468569 0.59040153 0.66075622 0.37884514 0.44310646
0.52721738 0.36697478 0.93268292]
x= np.random.uniform(size = 15)
x = 10 + (40-10)*x
print (x)
[34.69235921 18.21719342 28.65518941 25.69825302 33.90922192 33.49102491
12.65406565 14.99326153 24.83945876 16.39104195 25.36248202 37.67357601
33.87838224 37.50340663 35.41190932]
x= np.random.normal (size = 15)
print (x)
[-0.24847297 0.29390991 1.11447454 -0.33452251 1.46154283 0.39935661
0.54576934 0.17896899 1.20270787 0.58409325 0.16312952 0.58047423
-0.56791023 0.36096416 -0.65787285]
x= np.random.normal(size = 10)
x = 20 + (.5)*x
print (x)
[19.52784021 20.41674053 20.46368809 19.87274801 19.62637381 19.84475396
20.25355222 19.38288125 20.01957747 19.21921423]