On 25/02/17 10:35, ehsan faraz wrote:
> ... where “tip” is an invalid syntax. 

You need to assign a value to tip before trying
to read it, otherwise tip is undefined.

Similarly you should define price before trying
to use it.

But those would give you a NameError not a
syntax error... Can you send us the full error
text please (always do this when posting, it
helps a lot)


> sales_tax = 0.085 * price
> total_due = sales_tax * price + tip

You access price and tip before defining them.

And shouldn't that * be a +?

> tip = tip

This line does nothing

> print("Welcome to Restaurant Helper.")

> price = int(input("Enter the menu price for your meal:")
> tip = int(input("Enter your tip percentage:")

You need these 2 lines before the calculations above.

> print("The price of the meal is:" , price)
> print("The sales tax due is:" , sales_tax)
> print("The tip amount is:" , tip)
> print("the total due is:" , total_due) 


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to