Student Grade Tracker
🎯 Project: Student Grade Tracker
Let's build a student grade tracking system using dictionaries! This project will help you practice working with dictionaries, nested data structures, and data manipulation. You'll create a program that stores student information and their grades, then calculates averages and displays reports.
This project combines dictionaries, lists, loops, and functions to create a practical grade management system.
Project Requirements
Your grade tracker should:
- Store student information (name, ID, grades)
- Add students and their grades
- Calculate average grades for each student
- Display student information and grades
- Find students by name or ID
- Display class statistics
Step-by-Step Implementation
Here's how to build the grade tracker:
grade_tracker.py
# Initialize students dictionary
students = {}
# Add a student
students["S001"] = {
"name": "Alice",
"grades": [85, 90, 88]
}
# Calculate average
def calculate_average(grades):
return sum(grades) / len(grades) if grades else 0
# Display student info
for student_id, info in students.items():
avg = calculate_average(info["grades"])
print(f"{info['name']} (ID: {student_id}): Average = {avg:.2f}")
# Add more students
students["S002"] = {
"name": "Bob",
"grades": [92, 87, 95]
}
# Find student by name
for student_id, info in students.items():
if info["name"] == "Alice":
print(f"Found: {student_id}")
Enhancement Ideas
Try adding these features to enhance your grade tracker:
- Add subjects/courses for each student
- Calculate class average
- Find highest and lowest grades
- Sort students by average grade
- Save/load data from a file
- Generate grade reports
main.py
📤 Output
Click "Run" to execute...