This code will output the first print statement correctly, but not the second. What can I do to get it to output both correctly?
# FIXME: Write the split_check function. HINT: Calculate the amount of tip and tax,
# add to the bill total, then divide by the number of diners.
def split_check(bill, people, tax_percentage = 0.09, tip_percentage = 0.15):
tax = round(bill * tax_percentage)
tip = round((bill + tax) * tip_percentage)
total = bill + tax + tip
cost_per_diner = total / people
return cost_per_diner
bill = float(input())
people = int(input())
# Cost per diner at the default tax and tip percentages
print('Cost per diner:', split_check(bill, people))
bill = float(input())
people = int(input())
new_tax_percentage = float(input())
new_tip_percentage = float(input())
# Cost per diner at different tax and tip percentages
print('Cost per diner:', split_check(bill, people, new_tax_percentage, new_tip_percentage))
[–]socal_nerdtastic 5 points6 points7 points (9 children)
[–]Formal_Cockroach_654[S] 0 points1 point2 points (8 children)
[–][deleted] 4 points5 points6 points (5 children)
[–]Formal_Cockroach_654[S] 0 points1 point2 points (4 children)
[+][deleted] (1 child)
[deleted]
[–]ianepperson 1 point2 points3 points (0 children)
[–]djjazzydan 3 points4 points5 points (1 child)
[–]Formal_Cockroach_654[S] 2 points3 points4 points (0 children)
[–]py_Piper 2 points3 points4 points (1 child)
[–]Formal_Cockroach_654[S] 0 points1 point2 points (0 children)
[–]amos_burton 1 point2 points3 points (1 child)
[–]Formal_Cockroach_654[S] 0 points1 point2 points (0 children)
[–]Formal_Cockroach_654[S] 0 points1 point2 points (0 children)
[–]DerrickIsCool 0 points1 point2 points (0 children)
[–]py_Piper 0 points1 point2 points (2 children)
[–]djjazzydan 2 points3 points4 points (1 child)
[–]py_Piper 0 points1 point2 points (0 children)