CBSE Class 12 Informatics Practices Question 18 of 18

Practice Paper — Question 5

Back to all questions
5
Question

Question 35(b)

Write Python code to create a Line graph using the list of elements x and y. Set ylabel as "marks" and xlabel as "names". The title of the graph is 'Result'.

x = ['A', 'B', 'C', 'D', 'E']
y = [82, 25, 87, 14, 90]
Answer
import matplotlib.pyplot as plt
x = ['A', 'B', 'C', 'D', 'E']
y = [82, 25, 87, 14, 90]
plt.plot(x, y, marker='o')
plt.xlabel('names')
plt.ylabel('marks')
plt.title('Result')
plt.show()
Output
Write Python code to create a Line graph using the list of elements x and y. Set ylabel as marks and xlabel as names. The title of the graph is 'Result'. Societal Impacts, Informatics Practices Preeti Arora Solutions CBSE Class 12
Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.