the round function is not rounding and therefore the follow on calculation is not working and I keep getting the same error message telling me that "my code does not assign the result of ‘round final_bill, 2’ ( well no s**t, that’s because the system wont round it) to the variable ‘each_pays’. so since that’s the only error message logic would dictate the system is the problem given all other instructions have been followed. yes I’ve read, asked and now posting. I’ve tried the code they instruct multiple other ways non work. this last piece of code was the last attempt at another way before posting. disregard the code and read the words in this post. if the simple function of round() is not working and the number is not being rounded then what do we do?
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
also, regardless if I put the rounded number in there because the system wont I still get the same error messages.
final_bill = running_total / num_of_friends
print('Bill per person:', final_bill)
round(final_bill, 2)
each_pays = 62.13
print('Each person pays:', each_pays)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
nice, I appreciate the information. check this out though, I implemented your rec for “print” and it still will not round. I don’t understand why. that said, I finished the rest of the code AS IF everything was operating normally meaning I manually rounded the number myself. once finished I hit “check your code” and it gave the same error message telling to use the round function. I also got that error code when I checked it using only the rec as well just to see what would happen. I’m at a loss and I need this cert. any ideas?
2nd post. round function not working. finished code and manually rounded the number myself. submitted the finished code and only get the same error message back stating to use the round function. implemented the suggestion from someone offering help but still not working. the round function will not round to any decimal place and the rounded nuded does not populate on the right, it prints the whole number. any ideas?
cheers
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(round(final_bill, 2))
each_pays = 62.13
print('Each person pays:' , each_pays)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
You cannot round a variable in place. The instructions ask you to assign the rounded value to the variable each_pays, which you are not doing. Instead, you are attempting to round final_bill in place, and you are hard coding a value to each_pays.