CodingNic

Data Structures

Data Structures Challenges and Projects

Data Structures 32 min read

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:
python
["Milk", "Bread", "Eggs"]
  • Add Juice
  • Remove Bread
  • Print the final list

Expected output:

text
['Milk', 'Eggs', 'Juice']

Challenge 2: Country Tuple

Steps:

  • Create a tuple:
python
("USA", "Canada", "Mexico")
  • Print the first item
  • Print the last item

Expected output:

text
USA
Mexico

Challenge 3: Profile Dictionary

Steps:

  • Create a dictionary:
python
{"name": "Tom", "age": 25}
  • Update age to 26
  • Add:
python
"city": "Toronto"
  • Print the final dictionary

Expected output:

text
{'name': 'Tom', 'age': 26, 'city': 'Toronto'}

Challenge 4: Unique Skills

Steps:

  • Create a set:
python
{"Python", "HTML", "Python"}
  • Print the final set

Expected output:

text
{'Python', 'HTML'}

Mini Projects

Project 1: Student Records

Build a student records system.

Steps:

  • Create this list of dictionaries:
python
[
    {"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:

text
Sara 92
Tom 85
Ali 70

Project 2: Store Inventory

Build a product inventory.

Steps:

  • Create this dictionary:
python
{
    "name": "Laptop",
    "price": 900,
    "stock": 5
}
  • Update stock to 10
  • Print all keys and values using a loop

Expected output:

text
name Laptop
price 900
stock 10

Project 3: Unique Tags Tool

Build a tags manager.

Steps:

  • Create a set:
python
{"python", "coding", "python"}
  • Add course
  • Print all tags

Expected output:

text
{'python', 'coding', 'course'}

Project 4: Product Sorter

Build a sorted product list.

Steps:

  • Create this list:
python
[
    {"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:

text
Pen 2
Book 10
Laptop 900

Final Challenge

Build a classroom manager.

Steps:

  • Create this dictionary:
python
{
    "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 80 or more

Expected output:

text
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

  1. Which structure stores key-value pairs?
  2. Which structure removes duplicates?
  3. Which structure is fixed after creation?
  4. 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.