Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

etmp 1> 1 import numpy as np 2 import matplotlib.pyplot as plt Datalist= (2.86,

ID: 3885642 • Letter: E

Question

etmp 1> 1 import numpy as np 2 import matplotlib.pyplot as plt Datalist= (2.86, 2.75, 2.82, 2.91, 2.71, 2.84, 2.92, 2.80, 2.89, 2.77, 2.98, 2.82, 2.69, 2.84, 2.91, 3.02, 2.99, 2.83, 2.79 2.76) 5 Datanp.array (Datalist) 7 avgsum (Data)/len (Data) 8 print ( 'average of data:', avg) 10 axplt.axes(!) 12 ax.hist(Data, bins-range (2.65,3.05,8), 13 ax.set xlabel( 'Data Value 15 alpha-.5, histtype-'stepfilled') 14 ax.set ylabel ( 'number of counts per bin of 8) 16 plt.savefig("SampleHistPlt.png") 17 plt.show() 18 19

Explanation / Answer

range() is working with integers only and not for float values.
So for Float values you can use

import numpy as np
ax.hist(data, bins=np.arange(2.65,3.05,8),alpha=.5, histtype='stepfilled')