# Total math

#1

total lesson 5

it says that the formula is wrong but i followed the instructions T_T

``````# Assign the variable total on line 8!

meal = 44.50
tax = 0.0675
tip = 0.15

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

print("%.2f" % total)``````

#2

Hey, @mrpon! You're really close. Let's go through your code and the instructions:

Your first three lines are correct.

``````meal = 44.50
tax = 0.0675
tip = 0.15``````

Remember when we set variables that it is equal to the value. Therefore, we can write the variable in its place.

`meal = 44.50 + 44.50 * 0.15` is the same as writing `meal = meal + meal * tax`. This is also true for your `total` variable.

Now, the instructions:

Assign the variable total to the sum of meal + meal * tip on line 8. Now you have the total cost of your meal!

`total = ?` Try to finish the rest.

#3

Nope still got 51.17

#4

Can you post your new code?

#5

# Assign the variable total on line 8!

meal = 44.50
tax = 0.0675
tip = 0.15

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

print("%.2f" % total)

#6

@mrpon This looks exactly like your original code. I think you're getting confused with variables. Because you assigned the values in your first three lines of code to the variables `meal`, `tax`, and `total`; Python remembers all the values.

`meal = 44.50 + 44.50 * 0.15` is exactly the same as literally writing `meal = meal + meal * tip`.

The reason for the error is because of this line: `meal = 44.50 + 44.50 * 0.15`. It asked you to use tax but you used the value of tip.

Your code should look exactly like this:

``````meal = 44.50
tax = 0.0675
tip = 0.15

meal = meal + meal * tax
total = meal + meal * tip

print("%.2f" % total)``````

Just let me know if this is still confusing so that I can help you understand it by breaking it all down.

#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.