bill: an array of integers representing the cost of each item ordered
k: an integer representing the zero-based index of the item Anna doesn't eat
b: the amount of money that Anna contributed to the bill
If Brian did not overcharge Anna, print Bon Appetit on a new line; otherwise, print the difference (i.e., ) that Brian must refund to Anna. This will always be an integer.
import math
import os
import random
import re
import sys
#
# Complete the 'bonAppetit' function below.
#
# The function accepts following parameters:
# 1. INTEGER_ARRAY bill
# 2. INTEGER k
# 3. INTEGER b
#
def bonAppetit(bill, k, b):
# Write your code here
total = 0
for i in range(len(bill)):
if(i!=k):
total += bill[i]
total = total // 2
if(total == b):
print('Bon Appetit')
else:
print(abs(total - b))