Cart Total

In an online store, the final cart total depends on item prices, quantities, and a shared discount. Given a list items, where each item contains price and qty, and a discount percentage discount, calculate the total cost. Apply the discount and return the result rounded to two decimal places.

Примеры

Ввод
[[100, 2], [50, 1]], 0
Вывод
250
Ввод
[[100, 1]], 10
Вывод
90
Ввод
[], 50
Вывод
0

Нужно реализовать

def cart_total(items: list, discount: int) -> float:

Теги

dictmath
PostgreSQLv16

Le résultat de l'exécution du code s'affichera ici

Visible tests
1
Input
[[100,2],[50,1]], 0
Expected250
2
Input
[[100,1]], 10
Expected90
3
Input
[], 50
Expected0
4
Input
[[199,3]], 100
Expected0
5
Input
[[33,3]], 10
Expected89.1
6
Input
[[10,1],[20,2]], 25
Expected37.5
Focus radio
Paused · SomaFM · Fluid