Build a Bill Splitter - Step 8

Tell us what’s happening:

The round() is right until I add in the variable each_pays. round() is also not rounding to two decimal points. I’ve done the full code and it runs but not as intended. No final_bill to two decimal points and after adding the variable each_pays with either final_bill or round to complete it there’s an error that round() didn’t get input properly

Your code so far

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)

final_bill = running_total / num_of_friends
print('Bill per person:', final_bill)


# User Editable Region

round(final_bill, 4)
each_pays= final_bill


# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Challenge Information:

Build a Bill Splitter - Step 8

Welcome to the forum @jrmygilkes122

From the code you posted, you did not assign the rounded number to the each_pays variable .

You also need to round to a certain number of decimal places, and print a string and a variable.

Happy coding

1 Like

So the round() doesn’t round the float to a two decimal point float it has to be stated in the round() for it to be brought to the two decimal point float?

Your code is rounding to 4 decimal places, as your code uses 4 for the second parameter.

1 Like

I haven’t added the each_pays variable because I wanna make sure I’ve got this right first

1 Like

removed by moderator

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like

It’s been a little while and my solutions have been to do what’s in the code or use the round operator for the each_pays variable but neither are working including the round operator which just brings it to 62.134374 with the roun(final_bill, 2) put in