I understand the correct code for this exercise is:
meal = 44.50
tax = 6.75 / 100
tip = 15.0 / 100
meal = meal + meal * tax
total = meal + meal * tip
print("%.2f" % total)
My issue is that when I do it by hand, it seems totally off.
If I sub in the new value of “meal” as meal = meal + meal * tax in the total line, you get:
total = (meal + meal * tax) + (meal + meal * tax) * tip
With the order of operations and with the initial values, you get:
44.50 + 44.50 * .0675 + 44.50 + 44.50 * .15 =
44.50 + 3.00375 + 44.50 + 6.675 =
Which is pretty clearly not correct. Maybe the code in line 10 takes the above math and does something to it that yields the correct answer of 54.63? I’m trying to understand the syntax here more than specifically how to pass this exercise. Thanks!