Data Structures Challenges and Projects
Data Structures Challenges and Projects
Great job finishing this module.
You have learned how to use:
- lists
- tuples
- dictionaries
- sets
- nested data structures
- list comprehensions
- common methods
- real project data models
- sorting data
Now it is time to practice everything together.
Quick Challenges
Try to solve these on your own.
Challenge 1: Shopping List
Steps:
- Create a list:
["Milk", "Bread", "Eggs"]
- Add
Juice - Remove
Bread - Print the final list
Expected output:
['Milk', 'Eggs', 'Juice']
Challenge 2: Country Tuple
Steps:
- Create a tuple:
("USA", "Canada", "Mexico")
- Print the first item
- Print the last item
Expected output:
USA
Mexico
Challenge 3: Profile Dictionary
Steps:
- Create a dictionary:
{"name": "Tom", "age": 25}
- Update age to
26 - Add:
"city": "Toronto"
- Print the final dictionary
Expected output:
{'name': 'Tom', 'age': 26, 'city': 'Toronto'}
Challenge 4: Unique Skills
Steps:
- Create a set:
{"Python", "HTML", "Python"}
- Print the final set
Expected output:
{'Python', 'HTML'}
Mini Projects
Project 1: Student Records
Build a student records system.
Steps:
- Create this list of dictionaries:
[
{"name": "Tom", "score": 85},
{"name": "Sara", "score": 92},
{"name": "Ali", "score": 70}
]
- Print each student name and score
- Sort students by highest score first
- Print the sorted result
Expected output:
Sara 92
Tom 85
Ali 70
Project 2: Store Inventory
Build a product inventory.
Steps:
- Create this dictionary:
{
"name": "Laptop",
"price": 900,
"stock": 5
}
- Update stock to
10 - Print all keys and values using a loop
Expected output:
name Laptop
price 900
stock 10
Project 3: Unique Tags Tool
Build a tags manager.
Steps:
- Create a set:
{"python", "coding", "python"}
- Add
course - Print all tags
Expected output:
{'python', 'coding', 'course'}
Project 4: Product Sorter
Build a sorted product list.
Steps:
- Create this list:
[
{"name": "Book", "price": 10},
{"name": "Laptop", "price": 900},
{"name": "Pen", "price": 2}
]
- Sort by price low to high
- Print each product name and price
Expected output:
Pen 2
Book 10
Laptop 900
Final Challenge
Build a classroom manager.
Steps:
- Create this dictionary:
{
"teacher": "Maya",
"students": [
{"name": "Tom", "score": 85},
{"name": "Sara", "score": 92},
{"name": "Ali", "score": 70}
]
}
Tasks:
- Print teacher name
- Print each student name and score
- Sort students by score highest first
- Print only students with score
80or more
Expected output:
Teacher: Maya
Sara 92
Tom 85
Ali 70
Sara
Tom
Real World Use Case
Every real app uses data structures to organize users, products, settings, reports, and large collections of data.
Quiz
- Which structure stores key-value pairs?
- Which structure removes duplicates?
- Which structure is fixed after creation?
- Why is sorting useful?
Assignment
Choose one project and improve it by adding more data, cleaner output, or extra features.
Summary
You completed the Data Structures module and practiced using Python collections in real projects.