Добавлена функция calculate_user_total
This commit is contained in:
parent
e68ebc4130
commit
40786b2517
10
zadanie_1.py
10
zadanie_1.py
@ -57,4 +57,12 @@ def group_by_user(orders: list[dict]) -> dict[int, list[dict]]:
|
||||
if uid not in grouped:
|
||||
grouped[uid] = []
|
||||
grouped[uid].append(order)
|
||||
return grouped
|
||||
return grouped
|
||||
|
||||
|
||||
# 4. Расчет общей суммы трат пользователя
|
||||
def calculate_user_total(user_orders: list[dict]) -> float:
|
||||
"""
|
||||
Суммирует все значения 'total' для одного пользователя.
|
||||
"""
|
||||
return sum(order['total'] for order in user_orders)
|
||||
Loading…
Reference in New Issue
Block a user