Build a Student Manager
🐍 PythonProject: build a console-based student management system.
0/7 completed
Project: Student Manager
Build a console app that manages student records.
Requirements
- Add students (name, grade, class)
- List all students
- Search for a student by name
- Delete a student
- 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
🚀 Start Project
- 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