Informatics Practices

The heights of 10 students of eighth grade are given below :

Height_cms = [145, 141, 142, 142, 143, 144, 141, 140, 143, 144] 

Write suitable Python code to generate a histogram based on the given data, along with an appropriate chart title and both axis labels. Also give suitable python statement to save this chart.

PyPlot

3 Likes

Answer

import matplotlib.pyplot as plt
Height_cms = [145, 141, 142, 142, 143, 144, 141, 140, 143, 144] 
plt.hist(Height_cms)
plt.title('Distribution of Heights of Eighth Grade Students')
plt.xlabel('Height (cm)')
plt.ylabel('Frequency')
plt.savefig('heights_histogram.png')
plt.show()
Output
The heights of 10 students of eighth grade are given below : Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Answered By

2 Likes


Related Questions