Thursday, November 13, 2025

🎯 PROJECT: Student Performance Analysis Using Lists + Matplotlib

 This project uses lists to store student data, calculates performance, and visualizes the result using matplotlib.


πŸ“Œ Project Objective

  • Store student names and marks using lists

  • Calculate total marks, percentage, and grade

  • Display a report

  • Visualize performance using a bar graph


πŸ“‚ Dataset (Using Lists)

names = ["Raghav", "Aman", "Simran", "Khushi", "Arjun"] math = [78, 90, 65, 88, 72] science = [82, 88, 70, 91, 75] english = [75, 92, 68, 85, 80]

🧠 Complete Working Project Code

# ------------------------------- # Student Performance Analysis # ------------------------------- # Lists (Dataset) names = ["Raghav", "Aman", "Simran", "Khushi", "Arjun"] math = [78, 90, 65, 88, 72] science = [82, 88, 70, 91, 75] english = [75, 92, 68, 85, 80] # Empty lists to store calculated results total = [] percentage = [] grade = [] # Function to calculate grade def get_grade(p): if p >= 90: return "A+" elif p >= 75: return "A" elif p >= 60: return "B" else: return "C" # Calculate total, percentage, grade for i in range(len(names)): t = math[i] + science[i] + english[i] total.append(t) p = t / 3 percentage.append(p) grade.append(get_grade(p)) # Display report print("STUDENT PERFORMANCE REPORT") print("----------------------------------------") for i in range(len(names)): print(f"{names[i]} | Total: {total[i]} | %: {percentage[i]:.2f} | Grade: {grade[i]}") # ------------ Matplotlib Chart -------------- import matplotlib.pyplot as plt plt.figure(figsize=(10, 6)) plt.bar(names, percentage) # Bar graph plt.title("Student Performance Chart") plt.xlabel("Students") plt.ylabel("Percentage") plt.ylim(0, 100) # Display values on top of bars for i in range(len(names)): plt.text(i, percentage[i] + 1, f"{percentage[i]:.1f}%", ha='center') plt.show()

πŸ“Š Graph Output

The bar graph will show:

  • X-axis → Student names

  • Y-axis → Percentage

  • Bars → Performance comparison


πŸ“œ Features of This Project

✔ Uses lists as the main data structure
✔ Uses loops + functions
✔ Generates a text report
✔ Visualizes output using matplotlib
✔ Beginner-friendly, perfect for school/college projects

No comments:

Post a Comment

Python Viva Questions

  Basic Python Viva Questions 1. What is Python? Python is a high-level, interpreted, and object-oriented programming language used for w...