📖 Scenario: You are working with a community group that wants to promote recycling and sustainability. They have collected data about different materials and their recycling rates. Your task is to organize this data and highlight materials that have recycling rates below a certain threshold to focus awareness efforts.
🎯 Goal: Build a simple data structure to hold recycling rates for materials, set a threshold for low recycling rates, identify materials below this threshold, and mark them for special attention.
📋 What You'll Learn
Create a dictionary called materials with exact entries for recycling rates
Create a variable called low_threshold set to 50
Use a dictionary comprehension called low_recycling to select materials with recycling rates below low_threshold
Add a final key-value pair 'focus_area': True to low_recycling to mark it for awareness campaigns
💡 Why This Matters
🌍 Real World
Communities and environmental groups often track recycling rates to focus their sustainability efforts where they are most needed.
💼 Career
Data organization and filtering skills are essential for environmental analysts, sustainability coordinators, and community planners.
Progress0 / 4 steps
1
Create the recycling data dictionary
Create a dictionary called materials with these exact entries: 'Plastic': 30, 'Glass': 70, 'Paper': 60, 'Metal': 45, 'Electronics': 20
EV Technology
Hint
Use curly braces {} to create a dictionary with keys as material names and values as recycling rates.
2
Set the low recycling threshold
Create a variable called low_threshold and set it to 50
EV Technology
Hint
Just assign the number 50 to the variable low_threshold.
3
Select materials below the threshold
Use a dictionary comprehension called low_recycling to select materials from materials where the recycling rate is less than low_threshold
EV Technology
Hint
Use a dictionary comprehension with for material, rate in materials.items() and an if condition to filter.
4
Mark low recycling materials for focus
Add a key-value pair 'focus_area': True to the low_recycling dictionary
EV Technology
Hint
Use the assignment low_recycling['focus_area'] = True to add the new key-value pair.
Practice
(1/5)
1. What is the main goal of recycling in sustainability?
easy
A. To turn old materials into new products
B. To increase the use of plastic
C. To create more waste
D. To use more energy
Solution
Step 1: Understand recycling purpose
Recycling means reusing old materials to make new things.
Step 2: Connect recycling to sustainability
This reduces waste and saves resources, helping the environment.
Final Answer:
To turn old materials into new products -> Option A
Quick Check:
Recycling = reuse materials [OK]
Hint: Recycling means reusing old stuff [OK]
Common Mistakes:
Thinking recycling creates more waste
Believing recycling uses more energy
Confusing recycling with waste creation
2. Which of the following is a correct example of a sustainable action?
easy
A. Throwing all trash into one bin
B. Leaving lights on when not needed
C. Cutting down trees without planting new ones
D. Using reusable bags instead of plastic bags
Solution
Step 1: Identify sustainable actions
Sustainable actions save resources and reduce harm to nature.
Step 2: Evaluate each option
Using reusable bags reduces plastic waste, which is sustainable.
Final Answer:
Using reusable bags instead of plastic bags -> Option D
Quick Check:
Reusable bags = sustainable choice [OK]
Hint: Choose actions that save resources [OK]
Common Mistakes:
Thinking all trash in one bin is sustainable
Believing wasting electricity is sustainable
Ignoring tree planting importance
3. Consider this code snippet representing waste sorting:
bins = {'plastic': 5, 'paper': 3, 'glass': 2}
recycled = {k: v*2 for k, v in bins.items() if v > 2}
print(recycled)
What will be the output?
medium
A. {'plastic': 10, 'paper': 6}
B. {'plastic': 10, 'paper': 6, 'glass': 4}
C. {'plastic': 5, 'paper': 3}
D. {'glass': 4}
Solution
Step 1: Understand dictionary comprehension with condition
Only items with value > 2 are included and values doubled.
Step 2: Apply condition to bins
'plastic' (5) and 'paper' (3) qualify; 'glass' (2) does not.
Step 3: Calculate new values
'plastic': 5*2=10, 'paper': 3*2=6
Final Answer:
{'plastic': 10, 'paper': 6} -> Option A
Quick Check:
Filter >2 and double values = {'plastic':10,'paper':6} [OK]
Hint: Filter values >2, then double [OK]
Common Mistakes:
Including 'glass' which has value 2
Not doubling the values
Printing original dictionary
4. This code tries to calculate total recycled items but has an error:
items = {'plastic': 4, 'paper': 6, 'glass': 3}
total = 0
for item in items:
total += items[item]
print(totall)
What is the error?
medium
A. Using += instead of =
B. Missing colon after for loop
C. Variable name typo in print statement
D. Incorrect dictionary syntax
Solution
Step 1: Check variable names used
Variable 'total' is defined, but 'totall' is printed (typo).
Step 2: Identify impact of typo
Printing 'totall' causes a NameError because it is undefined.
Final Answer:
Variable name typo in print statement -> Option C
Quick Check:
Print typo = NameError [OK]
Hint: Check variable names carefully [OK]
Common Mistakes:
Ignoring typo and assuming logic error
Thinking dictionary syntax is wrong
Confusing += with =
5. A community wants to reduce waste by recycling and composting. They have 100 kg of waste: 40 kg plastic, 30 kg food scraps, 20 kg paper, and 10 kg glass. If they recycle all plastic, paper, and glass, and compost all food scraps, how much waste is diverted from landfill?
hard
A. 70 kg
B. 100 kg
C. 60 kg
D. 90 kg
Solution
Step 1: Identify recyclable and compostable waste
Plastic (40 kg), paper (20 kg), glass (10 kg) are recycled; food scraps (30 kg) are composted.
Step 2: Calculate total diverted waste
Sum recycled and composted: 40 + 20 + 10 + 30 = 100 kg.
Step 3: Confirm total waste and diversion
Total waste is 100 kg; all waste is diverted from landfill.
Final Answer:
100 kg -> Option B
Quick Check:
All waste recycled or composted = 100 kg diverted [OK]
Hint: Add all recycled + composted weights [OK]
Common Mistakes:
Forgetting to include composted food scraps
Adding only recycled waste
Misreading total waste amount
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.