Jul-11-2025, 10:35 AM
(This post was last modified: Jul-11-2025, 10:36 AM by aryasinner.)
Hi everyone,
I'm working on a small exercise where I need to sort a list of dictionaries representing products. Each product dictionary looks like this:
Filter only products with currency "USD".
Sort the result by price (ascending).
Print just the names of the sorted products.
Please help me!
Slope Game
I'm working on a small exercise where I need to sort a list of dictionaries representing products. Each product dictionary looks like this:
products = [
{"name": "Laptop", "price": {"amount": 999, "currency": "USD"}},
{"name": "Smartphone", "price": {"amount": 499, "currency": "USD"}},
{"name": "Tablet", "price": {"amount": 299, "currency": "EUR"}},
{"name": "Monitor", "price": {"amount": 199, "currency": "USD"}},
{"name": "Camera", "price": {"amount": 599, "currency": "EUR"}},
]I want to:Filter only products with currency "USD".
Sort the result by price (ascending).
Print just the names of the sorted products.
Please help me!
Slope Game
