In the previous lesson, we learned about APIs and JSON handling in Python, including how applications communicate using web requests. Today, we will combine everything we have learned so far into a revision of core data structures and a mini Python project to strengthen your understanding.
This lesson marks an important milestone because it brings together concepts from earlier days into real programming practice.
Python Data Structures Revision
Python provides four main built-in data structures:
- Lists
- Tuples
- Sets
- Dictionaries
Each one is used for a different purpose.
- Lists (Mutable Collection)
Lists store multiple items and can be changed.
Example
students = ["Augustine", "Brian", "John"]
students.append("Mary")
print(students)
Key Features
- Ordered
- Changeable
- Allows duplicates
- Tuples (Immutable Collection)
Tuples store data that should not change.
Example
coordinates = (10, 20)
print(coordinates)
Key Features
- Ordered
- Not changeable
- Faster than lists
- Sets (Unique Items Collection)
Sets store only unique values.
Example
numbers = {1, 2, 2, 3, 4}
print(numbers)
Output
{1, 2, 3, 4}
Key Features
- Unordered
- No duplicates
- Fast membership testing
- Dictionaries (Key-Value Pairs)
Dictionaries store data in key-value format.
Example
student = {
"name": "Augustine",
"age": 21,
"course": "Python"
}
print(student["name"])
Key Features
- Key-value structure
- Fast data lookup
- Changeable
Mini Project: Student Management System
Now let’s combine everything into a simple project.
This system will:
- Store student records
- Add students
- Display students
- Prevent duplicate entries
Step 1: Create Student Storage (Dictionary + List)
students = []
Step 2: Add Students Function
def add_student(name, age):
student = {
"name": name,
"age": age
}
students.append(student)
Step 3: Display Students Function
def display_students():
for student in students:
print(student["name"], "-", student["age"])
Step 4: Prevent Duplicate Students (Set Concept)
student_names = set()
def add_student(name, age):
if name in student_names:
print("Student already exists")
else:
student = {
"name": name,
"age": age
}
students.append(student)
student_names.add(name)
Step 5: Full Program
students = []
student_names = set()
def add_student(name, age):
if name in student_names:
print("Student already exists")
else:
students.append({"name": name, "age": age})
student_names.add(name)
def display_students():
for student in students:
print(student["name"], "-", student["age"])
add_student("Augustine", 21)
add_student("Brian", 22)
add_student("Augustine", 21)
display_students()
Expected Output
Student already exists
Augustine - 21
Brian - 22
What You Have Learned So Far (Days 1–20)
You now understand:
- Python basics (variables, loops, functions)
- Data structures (lists, tuples, sets, dictionaries)
- File handling
- Exception handling
- Modules and packages
- Object-oriented programming
- GUI programming (Tkinter)
- Web development (Flask)
- APIs and JSON handling
Why This Matters
These concepts are the foundation of:
- Web development
- Mobile applications
- Data science
- Artificial intelligence
- Automation systems
Conclusion
This final beginner project shows how different Python concepts work together in real applications. By combining data structures, functions, and logic, you can build simple but powerful systems.
At this stage, you are ready to move from beginner level to intermediate Python programming.
Continue practicing by expanding this project with features like:
- Editing student data
- Deleting students
- Saving to files or databases
- Creating a GUI version
Top comments (0)