Добавлена функция filter_by_price_threshold
This commit is contained in:
parent
94d132aa97
commit
cf16f9915a
10
zadanie_1.py
10
zadanie_1.py
@ -90,4 +90,12 @@ def apply_discount(orders: list[dict], discount_percent: float) -> list[dict]:
|
||||
new_order = order.copy()
|
||||
new_order['total'] = order['total'] * (1 - discount_percent / 100.0)
|
||||
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]
|
||||
Loading…
Reference in New Issue
Block a user