Total variable on line 8


#1

I'm following the instructions exactly but it's saying I'm doing this wrong. Can't figure out my mistake. I put "total = meal + meal * tip" on line 8 like it said.

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


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


File "python", line 1
+# Assign the variable total on line 8!
^
SyntaxError: invalid syntax


+# 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)


#2

on line 1:

+# Assign the variable total on line 8!

you have a plus sign (first character of the sentence) before the comment, which causes syntax trouble resulting in a error message.


#3

Ah, thank you. No idea how that got there.


#4

I am doing the formula to calculate the total = meal + meal * tip but I am not getting the correct answer. I am following order of operations and multiplying the meal X tip and then adding another meal and I am not getting the correct answer. Please help!


#5

the answer i am getting is 51.17 and that is not the correct answer 54.63. The numbers I am using are as follows:

meal = 44.50
tax = 0.0675
tip = 0.15

Please let me know what error I am making


#6

The meal cost doesn't have the taxes included, you would have to calculate that first. Currently, you are calculating the tip over a meal without taxes


#8

I figured it out. The mistake I was making was that I was using the old meal price instead of the new meal price that I calculated in the step before. Thanks for your help.


#9

Thank you so much.

I've been strugling for some minutes now how to resolve the total problem and now I did it.


#10