CBSE Class 12 Informatics Practices Question 52 of 73

Data Visualization using Matplotlib — Question 17

Back to all questions
17
Question

Question 17

Plot a histogram of a class test of 40 students based on random sets of marks obtained by the students (MM=100).

Answer
import matplotlib.pyplot as plt
import numpy as np
marks = np.random.randint(0, 101, 40)
plt.hist(marks)
plt.title('Class Test Marks')
plt.xlabel('Marks')
plt.ylabel('Frequency')
plt.show()
Output
Plot a histogram of a class test of 40 students based on random sets of marks obtained by the students (MM=100). Data Visualization using Matplotlib, Informatics Practices Preeti Arora Solutions CBSE Class 12