Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialja5on
10,338 PointsMy code with round to 2 decimal places. Didn't need to import math.
I did this for anyone wanting a more accurate calculation, what if it wasn't a meal but another calculation that needed a more exact answer.
line 12. print("Each person owes £{}".format(round(amount_due, 2)))
Happy coding.
1 Answer
Steven Parker
231,269 PointsRounding up to the next dollar is a very practical approach to this particular situation since folks generally don't want to handle change when paying for a check.
And the comment about "nobody's getting ripped off anymore" is just his sense of humor. If this is your first lesson with Craig, you may have a bit of accustomization in store in future videos.
David Mobley
5,574 PointsI disagree about the practicality, but I suppose it doesn't matter - I know he is using it as a teaching tool - I just think it's a dumb example... however, I'm still paying for this... so... there's that I suppose.
David Mobley
5,574 PointsDavid Mobley
5,574 PointsYea, I found this as well - I get that he was trying to show us import... but his example is stupid... check is $84 and some change and math.ceil spits out that everyone will owe $22 and then he says "then no one will get ripped off...", so dumb...