Search Your Question...!

Showing posts with label Bill Division. Show all posts
Showing posts with label Bill Division. Show all posts

Bill Division | Python Solution | Hackerrank

Two friends Anna and Brian, are deciding how to split the bill at a dinner. Each will only pay for the items they consume. Brian gets the check and calculates Anna's portion. You must determine if his calculation is correct.

For example, assume the bill has the following prices: Bill=[2,4,6]. Anna declines to eat item k= bill[2] which costs 6. If Brian calculates the bill correctly, Anna will pay (2+4)/2=3. If he includes the cost of bill[2], he will calculate (2+4+6)/2=3. In the second case, he should refund 3 to Anna.