New! Explore our Programming Academy and AI Tutor - learn to code from scratch, free to start. Explore Now
Programming Python Build a Student Manager

Build a Student Manager

🐍 Python

Project: build a console-based student management system.

Lesson 5 of 7 Project
0/7 completed

Project: Student Manager

Build a console app that manages student records.

Requirements

  1. Add students (name, grade, class)
  2. List all students
  3. Search for a student by name
  4. Delete a student
  5. Show class average

Sample Output

=== Student Manager ===
1. Add Student
2. List Students
3. Search
4. Delete
5. Class Average
6. Exit
Choose: 1
Name: Amina
Grade: 92
Class: SS2
Student added!

Example

# Student Manager
students = []

def add_student():
    name = input("Name: ")
    grade = float(input("Grade: "))
    cls = input("Class: ")
    students.append({"name": name, "grade": grade, "class": cls})
    print(f"{name} added!
")

def list_students():
    if not students:
        print("No students yet.
")
        return
    print(f"
{'Name':<15} {'Grade':<8} {'Class':<8}")
    print("-" * 31)
    for s in sorted(students, key=lambda x: x["grade"], reverse=True):
        print(f"{s['name']:<15} {s['grade']:<8} {s['class']:<8}")
    print()

def search():
    q = input("Search name: ").lower()
    found = [s for s in students if q in s["name"].lower()]
    for s in found:
        print(f"  {s['name']} — Grade: {s['grade']} — Class: {s['class']}")
    if not found:
        print("No matches.")
    print()

def class_average():
    if not students:
        print("No students.
")
        return
    avg = sum(s["grade"] for s in students) / len(students)
    print(f"Class average: {avg:.1f}
")

# Main menu
while True:
    print("=== Student Manager ===")
    print("1. Add  2. List  3. Search  4. Delete  5. Average  6. Exit")
    choice = input("Choose: ")
    if choice == "1": add_student()
    elif choice == "2": list_students()
    elif choice == "3": search()
    elif choice == "5": class_average()
    elif choice == "6": break

print("Goodbye!")
🚀 Project

Build a Student Manager

Project: build a console-based student management system.

Requirements
  • 1. Add students (name, grade, class)
  • 2. List all students sorted by grade
  • 3. Search for a student by name
  • 4. Delete a student
  • 5. Show the class average
  • 6. Main menu loop that keeps running until Exit
🚀 Start Project

Lesson Nav

Lesson sections