Write a Python program to plot a pie chart comparing marks of five students as given below:

ICSE Class 10 Robotics & AI PYQ · 2026 Paper · Section B

4(iii)Written · 2026 · Section B · 2026 Paper

Write a Python program to plot a pie chart comparing marks of five students as given below:

stud_name = ['Jessica', 'Peter', 'Alexa', 'James', 'Ram']
marks = [48, 22, 14, 30, 49]

Import the necessary libraries.

Show SolutionHide Solution↓
import matplotlib.pyplot as plt

stud_name = ['Jessica', 'Peter', 'Alexa', 'James', 'Ram']
marks = [48, 22, 14, 30, 49]

plt.pie(marks, labels=stud_name)
plt.title("Marks of Students")
plt.show()

Output

Write a Python program to plot a pie chart comparing marks of five students as given below.ICSE 2026 Robotics & Artificial Intelligence Solved Question Paper.
← Previous questionNext question →

Browse the free Robotics & AI sample bank