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.
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

Related Questions
Write suitable SQL queries for the following :
(i) To calculate the exponent for 3 raised to the power of 4.
(ii) To display current date and time.
(iii) To round off the value -34.4567 to 2 decimal place.
(iv) To remove all the probable leading and trailing spaces from the column userid of the table named user.
(v) To display the length of the string ‘FIFA World Cup’.
Kabir has created the following table named exam :
RegNo Name Subject Marks 1 Sanya Computer Science 198 2 Sanchay IP 100 3 Vinesh CS 90 4 Sneha IP 99 5 Akshita IP 100 Help him in writing SQL queries to perform the following tasks :
(i) Insert a new record in the table having following values : [6, 'Khushi', 'CS', 85]
(ii) To change the value "IP" to "Informatics Practices" in Subject column.
(iii) To remove the records of those students whose marks are less than 30.
(iv) To add a new column Grade of suitable datatype.
(v) To display records of "Informatics Practices" subject.
XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The tables given below show the distance between different blocks and the number of computers in each block.
Block Z1 to Block Z2 80 metres Block Z1 to Block Z3 65 metres Block Z1 to Block Z4 90 metres Block Z2 to Block Z3 45 metres Block Z2 to Block Z4 120 metres Block Z3 to Block Z4 60 metres Number of computers installed at various buildings are as follows :
Block Number of computers Z1 135 Z2 290 Z3 180 Z4 195 The company is planning to form a network by joining these blocks.
(i) Out of the four blocks on campus, suggest the location of the server that will provide the best connectivity. Explain your response.
(ii) For very fast and efficient connections between various blocks within the campus, suggest a suitable topology and draw the same.
(iii) Suggest the placement of the following devices with justification
- Repeater
- Hub/Switch
(iv) VoIP technology is to be used which allows one to make voice calls using a broadband internet connection. Expand the term VoIP.
(v) The XYZ Media House intends to link its Mumbai and Delhi centers. Out of LAN, MAN, or WAN, what kind of network will be created? Justify your answer.
Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below :

Also give suitable python statement to save this chart.