Добавлена функция filter_by_price_threshold

This commit is contained in:
Антон Репин 2026-05-07 13:21:02 +03:00
parent 94d132aa97
commit cf16f9915a

View File

@ -91,3 +91,11 @@ def apply_discount(orders: list[dict], discount_percent: float) -> list[dict]:
new_order['total'] = order['total'] * (1 - discount_percent / 100.0) new_order['total'] = order['total'] * (1 - discount_percent / 100.0)
discounted_orders.append(new_order) discounted_orders.append(new_order)
return discounted_orders return discounted_orders
# 7. Фильтрация товаров по минимальной цене за единицу
def filter_by_price_threshold(orders: list[dict], min_price: float) -> list[dict]:
"""
Возвращает заказы, у которых price >= min_price.
"""
return [order for order in orders if order['price'] >= min_price]