curriculum/challenges/english/blocks/workshop-bill-splitter/6977a8bbcbdd557886bd0718.md
With the tip now included, you have the final amount for the entire group. You have to determine how much each person owes by dividing the total bill by the number of friends.
In Python, you use the forward slash / to perform division. For example:
half = 10 / 2
Create a variable named final_bill and assign it the result of dividing running_total by num_of_friends.
Finally, use the print() function to display the string Bill per person: followed by a space and the value of final_bill.
You should define a variable named final_bill.
({
test: () => assert(runPython(`
_Node(_code).has_variable('final_bill')
`))
})
You should use the / operator to divide running_total by num_of_friends and assign the result to your final_bill variable.
({
test: () => assert(runPython(`
_Node(_code).find_variable('final_bill').is_equivalent('final_bill = running_total / num_of_friends')
`))
})
You should print the string Bill per person: followed by a space and the final_bill variable.
({
test: () => assert(runPython(`
_Node(_code).has_call("print('Bill per person:', final_bill)") or _Node(_code).has_call("print(f'Bill per person: {final_bill}')")`))
})
running_total = 0
num_of_friends = 4
appetizers = 37.89
main_courses = 57.34
desserts = 39.39
drinks = 64.21
running_total += appetizers + main_courses + desserts + drinks
print('Total bill so far:', running_total)
tip = running_total * 0.25
print('Tip amount:', tip)
running_total += tip
print('Total with tip:', running_total)
--fcc-editable-region--
--fcc-editable-region--