5. the total


#1

meal = 44.50
tax = 0.0675
tip = 0.15

meal = meal + meal * tax
total = 44.50 + 44.50 * 0.15

print("%.2f" % total)

Please help, I dont understand what's wrong.
It writes "Oops, try again. It looks like the printed output is 51.17 instead of 54.63. Double check the instructions!"


#2

Does not look very programmatic, does it?


#3

well, I have no idea how to write it right


#4

"Assign the variable total to the sum of meal + meal * tip on line 8. Now you have the total cost of your meal!"
I wrote everything what it asked


#5

We use the variables, not the literals in progammatic form.

    total = meal * (1 + tip) * (1 + tax)

#6

@mtf,
Should it not be

total = (meal  * (1 + tax) ) * (1 + tip)

#7

According to the narrative, perhaps, but mathematically it doesn't matter. My main point was to illustrate the use of the variables, not literal values.


#8

leonhard.wettengmx.n
Mar 28
mtf

@mtf,
Should it not be

total = (meal * (1 + tax) ) * (1 + tip)

Still doesn't work?

Assign the variable total on line 8!

meal = 44.50
tax = 0.0675
tip = 0.15

meal = meal + meal * tax
total =

print("%.2f" % total)


#9

Just exactly as the instruction suggested will give you the right answer like this:

total = meal + meal * tip


#10