Fair Bill Split
Anna and Brian split a restaurant bill, but Anna did not eat one item, so she should not pay for it. The function bon_appetit receives the item costs bill, the index k of the item Anna skipped, and the amount b charged to Anna. If Anna was overcharged, return the refund amount. If the split was fair, return the string Bon Appetit.
Примеры
Ввод
[3, 10, 2, 9], 1, 12Вывод
5Ввод
[3, 10, 2, 9], 1, 7Вывод
"Bon Appetit"Ввод
[2, 2, 2], 0, 2Вывод
"Bon Appetit"Нужно реализовать
def bon_appetit(bill: list[int], k: int, b: int) -> object:
Теги
arraymath
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
[3,10,2,9], 1, 12Expected
52
Input
[3,10,2,9], 1, 7Expected
"Bon Appetit"3
Input
[2,2,2], 0, 2Expected
"Bon Appetit"4
Input
[4,4,4,4], 0, 6Expected
"Bon Appetit"5
Input
[5,5,5,5], 0, 10Expected
36
Input
[5,5,5,5], 0, -10Expected
-17Focus radio
Paused · SomaFM · Fluid