1. Draw the exam histogram
Write code Easy ✓ Completedscores holds the marks of 20 students. Create fig, ax = plt.subplots() and draw a histogram of scores with ax.hist() using the bins [0, 50, 60, 70, 80, 90, 100]. Keep what ax.hist() returns in the variables counts, edges, bars. Set the title to Exam scores, the x-axis label to Mark and the y-axis label to Students, then call plt.show().
import matplotlib.pyplot as plt
scores = [45, 52, 58, 61, 63, 67, 68, 70, 72, 74, 75, 77, 79, 81, 83, 85, 88, 91, 94, 97]
# draw the histogram here
import matplotlib.pyplot as plt
scores = [45, 52, 58, 61, 63, 67, 68, 70, 72, 74, 75, 77, 79, 81, 83, 85, 88, 91, 94, 97]
fig, ax = plt.subplots()
counts, edges, bars = ax.hist(scores, bins=[0, 50, 60, 70, 80, 90, 100])
ax.set_title("Exam scores")
ax.set_xlabel("Mark")
ax.set_ylabel("Students")
plt.show()