Best Promo
An order may have several promo codes, but only one can be applied, so you need the one that gives the lowest final amount. Given an order amount total and a list promos, where each promo contains min_total and percent, use only promos where total is high enough. Apply the most beneficial valid promo and return the final amount rounded to two decimal places.
Примеры
Ввод
1000, [[500, 10], [2000, 50]]Вывод
900Ввод
1000, [[1000, 20], [800, 15]]Вывод
800Ввод
100, [[500, 50]]Вывод
100Нужно реализовать
def best_promo(total: float, promos: list) -> float:
Теги
arraymath
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
EntrarVisible tests
1
Input
1000, [[500,10],[2000,50]]Expected
9002
Input
1000, [[1000,20],[800,15]]Expected
8003
Input
100, [[500,50]]Expected
1004
Input
200, []Expected
2005
Input
3000, [[1000,5],[2500,30],[3000,25]]Expected
21006
Input
50, [[50,10]]Expected
45Focus radio
Paused · SomaFM · Fluid