Problem with Tip calculator


#1


https://www.codecademy.com/courses/python-beginner-GB6hM/0/5?curriculum_id=4f89dab3d788890003000096

Assign the variable total to the sum of meal + meal * tip on line 8

Oops, try again. It looks like the printed output is 51.17 instead of 54.63. Double check the instructions!

How have I not followed the instructions?


The code I entered is: 
total = 44.50+44.50*0.15 

44.50(meal)+44.50(meal)*0.15(tip)


#2

In the previous lesson, you should have added a line to compute the tax and added that to the "meal" variable. So the value of "meal" is not actually 44.50 as you have written here but is 44.50 + tax. Add a line above your "total" line that updates the cost of meal to meal + tax and you should be good to go.


#3

Like this?

meal = 44.50 + 44.50 * 0.0675.

That's there on line 7. Is there something else I'm missing?


#4

Could you please paste the entire page of code that you have written for this lesson?


#5

@neo.rising when they asked you to write the code for total, they meant for you to write it in the form of the variable "meal" so that it works for any numerical value given to meal. Your actual code should look like this:

# Assign the variable total on line 8!

meal = 44.50
tax = 0.0675
tip = 0.15

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

print("%.2f" % total)

Hope that works for you! Let me know if you need more help. Good luck and happy coding!

-- @chipjumper36731


#6

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