CBSE Class 12 Informatics Practices Question 121 of 147

Plotting with Pyplot — Question 4

Back to all questions
4
Question

Question 2

Write the output from the given python code :

import matplotlib.pyplot as plt
Months = ['Dec', 'Jan', 'Feb', 'Mar']
Attendance = [70, 90, 75, 95]
plt.bar(Months, Attendance)
plt.show()
Answer
Output
Write the output from the given python code : Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12
Explanation

This code snippet uses Matplotlib to create a bar chart. The list Months contains the names of the months ['Dec', 'Jan', 'Feb', 'Mar'], while the list Attendance holds corresponding attendance values [70, 90, 75, 95]. The plt.bar() function is then used to create a bar plot, where each bar represents a month and its height corresponds to the attendance value. Finally, plt.show() is called to display the plot.