Answer:
def split_check(bill, people, tax_percentage = 0.09, tip_percentage = 0.15):
tip = bill * tip_percentage
tax = bill * tax_percentage
total = bill + tip + tax
return total / people
bill = float(input())
people = int(input())
print("Cost per diner: " + str(split_check(bill, people)))
bill = float(input())
people = int(input())
new_tax_percentage = float(input())
new_tip_percentage = float(input())
print("Cost per diner: " + str(split_check(bill, people, new_tax_percentage, new_tip_percentage)))
Step-by-step explanation:
Create a function called split_check that takes four parameters, bill, people, tax_percentage and tip_percentage (last two parameters are optional)
Inside the function, calculate the tip and tax using the percentages. Calculate the total by adding bill, tip and tax. Then, return the result of total divided by the number of people, corresponds to the cost per person.
For the first call of the function, get the bill and people from the user and use the default parameters for the tip_percentage and tax_percentage. Print the result.
For the second call of the function, get the bill, people, new_tip_percentage and new_tax_percentage from the user. Print the result.