๐ŸŽ“

    Student Grade Manager

    Intermediate-Advanced Project

    Manage student records and calculate statistics using dictionaries, OOP, and file persistence.

    Project Overview

    Goal: Store students and calculate averages.

    Concepts: Dictionaries, OOP, file persistence, exception handling.

    Key Features:

    • โ€ข Add/remove students
    • โ€ข Record grades for multiple subjects
    • โ€ข Calculate GPA and averages
    • โ€ข Generate grade reports
    • โ€ข Export data to CSV

    Technologies & Concepts:

    OOP (Classes)DictionariesFile I/OException HandlingStatistics

    Starter Code

    ๐Ÿ’ก Note: Interactive Code

    This is a command-line app that uses input() for user interaction. The browser demo below shows a simplified version. For the full interactive experience, copy the code below and run it in your local Python environment (IDLE, VS Code, or terminal).Jump to the Browser Demo.

    Here's a functional starting version of your app. Copy it to your local Python editor and run it.

    class Student:
        def __init__(self, name):
            self.name = name
            self.grades = []
        
        def add_grade(self, grade):
            if 0 <= grade <= 100:
                self.grades.append(grade)
                print(f"โœ“ Added grade {grade} for {self.name}")
            else:
                print("Grade must be between 0 and 100!")
        
        def average(self):
            return sum(self.grades) / len(self.grades) if self.grades else 0
        
        def get_letter_grade(self):
            avg = self.average()
            if avg >= 90: return "A"
            elif avg >= 80: return "B"
            elif avg >= 70: return "C"
            elif avg >= 60: return "D"
            else: return "F"
    
    students = {}
    
    def menu():
        print("\n๐Ÿ“š Student Grade Manager")
        print("1. Add Student")
        print("2. Add Grade")
        print("3. View All Students")
        print("4. View Student Report")
        print("5. Exit")
    
    while True:
        menu()
        choice = input("\nChoice: ")
        
        if choice == "1":
            name = input("Student name: ")
            students[name] = Student(name)
            print(f"โœ“ Added {name}")
        
        elif choice == "2":
            name = input("Student name: ")
            if name in students:
                try:
                    grade = float(input("Grade: "))
                    students[name].add_grade(grade)
                except ValueError:
                    print("Please enter a valid number!")
            else:
                print("Student not found!")
        
        elif choice == "3":
            if not students:
                print("No students yet!")
            else:
                print("\n๐Ÿ“Š All Students:")
                for s in students.values():
                    print(f"  {s.name}: {s.average():.1f} ({s.get_letter_grade()})")
        
        elif choice == "4":
            name = input("Student name: ")
            if name in students:
                s = students[name]
                print(f"\n๐Ÿ“ˆ Report for {s.name}")
                print(f"Grades: {s.grades}")
                print(f"Average: {s.average():.1f}")
                print(f"Letter Grade: {s.get_letter_grade()}")
            else:
                print("Student not found!")
        
        elif choice == "5":
            print("Goodbye!")
            break

    ๐Ÿš€ How to Run Locally:

    1. Copy the code above
    2. Save it as grade_manager.py
    3. Open terminal and run: python grade_manager.py
    4. Follow the interactive menu to manage students

    ๐ŸŽฎ Browser Demo (Simplified Version)

    This browser version demonstrates the core logic without user input. Click Run to see it work!

    Grade Manager Demo

    Try it Yourself ยป
    Python
    class Student:
        def __init__(self, name):
            self.name = name
            self.grades = []
        
        def add_grade(self, grade):
            if 0 <= grade <= 100:
                self.grades.append(grade)
                print(f"โœ“ Added grade {grade} for {self.name}")
            else:
                print("Grade must be between 0 and 100!")
        
        def average(self):
            return sum(self.grades) / len(self.grades) if self.grades else 0
        
        def get_letter_grade(self):
            avg = self.average()
         
    ...

    Enhancement Ideas ๐Ÿš€

    1. CSV Export

    Export student data to CSV format using the csv module for easy import into Excel.

    2. Multiple Subjects

    Track grades for different subjects (Math, English, Science) and calculate subject-specific averages.

    3. Grade Statistics

    Calculate class statistics like median, mode, highest, and lowest grades.

    4. Persistent Storage

    Save and load student data using JSON files so data persists between sessions.

    5. Search & Filter

    Add search functionality and filter students by grade range or letter grade.

    Next Steps

    1. Run the starter code and test basic functionality
    2. Add input validation for all user inputs
    3. Implement JSON file storage for persistence
    4. Create a proper grade report format
    5. Add multiple subject support
    6. Build class-wide statistics features
    7. Document and share your project!
    Back to Projects

    Cookie & Privacy Settings

    We use cookies to improve your experience, analyze traffic, and show personalized ads. You can manage your preferences below.

    By clicking "Accept All", you consent to our use of cookies for analytics and personalized advertising. You can customize your preferences or reject non-essential cookies.

    Privacy Policy โ€ข Terms of Service