Project 10: Real Estate Card
Python Challenge
Builds on these lessons
Step 1 of 3
Project
A Generator for Listings
Write def iter_listings(): with yield instead of return inside a loop. A generator produces values one at a time, lazily, as they're asked for — it never builds the whole list in memory upfront, which matters once "listings" means thousands of rows from a database.
🎯 Your Task
Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!
def iter_listings():
yield {"address": "142 Maple Street", "price": 489000}
yield {"address": "88 Birch Avenue", "price": 362000}
for listing in iter_listings():
print(listing["address"])