CodingNic

Data Structures

Python Capstone Project

Data Structures 60 min read

Python Capstone Project

Python Capstone Project

Great job reaching this point.

You have learned:

  • Python basics
  • Conditions
  • Loops
  • Functions
  • Data structures

Now it is time to build one real project that uses everything together.

Project: School Management System

You will build a simple school system that can:

  • Login
  • Show students
  • Add students
  • View top student
  • Show passing students
  • Calculate average score
  • Sort results
  • Exit the program

This project uses:

  • variables
  • input
  • if statements
  • loops
  • functions
  • lists
  • dictionaries
  • sets
  • sorting
  • nested data

Step 1: Starter Data

Create this data first.

python
school = {
    "name": "Bright Future Academy",
    "teacher": "Maya",
    "users": {
        "username": "admin",
        "password": "python123"
    },
    "students": [
        {"name": "Tom", "score": 85},
        {"name": "Sara", "score": 92},
        {"name": "Ali", "score": 70}
    ]
}

Step 2: Login System

Ask the user for:

  • username
  • password

Rules:

  • If entered username matches:
python
school["users"]["username"]

and entered password matches:

python
school["users"]["password"]

Print:

text
Login successful
  • Otherwise print:
text
Invalid login

Then stop the program.


Step 3: Main Menu

After login, keep showing this menu in a loop:

text
1. Show Students
2. Add Student
3. Top Student
4. Passing Students
5. Average Score
6. Unique Scores
7. Exit

Ask the user to choose an option.


Step 4: Create Functions

Create these functions.

show_students()

Print all student names and scores.

Example output:

text
Tom 85
Sara 92
Ali 70

add_student(name, score)

Add a new student to the list.

If user enters:

text
John
88

Then add:

python
{"name": "John", "score": 88}

top_student()

Sort students by score highest first.

Print:

text
Top Student: Sara 92

passing_students()

Print only students with score 80 or more.

Example output:

text
Tom
Sara

average_score()

Return the average of all scores.

Example output:

text
Average: 82.33

unique_scores()

Use a set to print unique scores only.

Example output:

text
{85, 92, 70}

Step 5: Connect Menu Options

Use if / elif to run the correct function based on menu choice.

Example:

python
if choice == "1":
    show_students()
elif choice == "2":
    ...

Step 6: Exit Option

If user chooses 7, print:

text
Goodbye

Then stop the loop.


Full Example Run

text
Login successful

1. Show Students
2. Add Student
3. Top Student
4. Passing Students
5. Average Score
6. Unique Scores
7. Exit

Choose: 1
Tom 85
Sara 92
Ali 70

Choose: 3
Top Student: Sara 92

Choose: 7
Goodbye

Extra Challenges

After finishing, try adding:

  • Remove student
  • Search student by name
  • Update score
  • Save to file later
  • Teacher dashboard
  • Grade letters (A, B, C)

Skills You Used

You used:

  • Variables
  • Strings and numbers
  • Input and output
  • Conditions
  • Loops
  • Functions
  • Lists
  • Dictionaries
  • Sets
  • Sorting
  • Nested data

Real World Use Case

This project teaches the same logic used in admin systems, dashboards, student portals, and business tools.


Assignment

Build the full project by yourself. Then add at least one extra feature.


Summary

You created a real Python application that combines everything from Modules 1 to 5 into one complete project.