• + 0 comments

    Here is my Python solution! If Ana paid the right amount of money, we print "Bon Appetit" and if not, we print the amount that Ana should be refunded (The amount Ana paid minus the actual amount she should have paid).

    def bonAppetit(bill, k, b):
        if (sum(bill) - bill[k]) / 2 == b:
            print("Bon Appetit")
        else:
            print(str(int(b - (sum(bill) - bill[k]) / 2)))