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
PostgreSQLv16

Koodin suorituksen tulos näkyy tässä

Visible tests
1
Input
[3,10,2,9], 1, 12
Expected5
2
Input
[3,10,2,9], 1, 7
Expected"Bon Appetit"
3
Input
[2,2,2], 0, 2
Expected"Bon Appetit"
4
Input
[4,4,4,4], 0, 6
Expected"Bon Appetit"
5
Input
[5,5,5,5], 0, 10
Expected3
6
Input
[5,5,5,5], 0, -10
Expected-17
Focus radio
Paused · SomaFM · Fluid