[Tutor] if then statements
Mark Lawrence
breamoreboy at yahoo.co.uk
Wed Apr 29 10:01:41 CEST 2015
On 29/04/2015 02:24, Jacqueline G Solis wrote:
> hello,
>
> I keep getting a syntax error. Could you please explain why that happens and how to correct it.
>
>
> def main ():
> print( "Welcome to Gonzo Burger!")
> order= int(input("Enter 1 if you want a hamburger,\
> or 2 if you want a cheeseburger:" ))
> if order == 1 :
> print("order: 1")
> else:
> print("Order: 2")
>
> drink=int(input("Thank you! Next, enter a 1 if you want a Coke,\
> or a 2 if you want a Sprite:")
> if drink == 1 :
> print("Order: 1")
> else:
> print("Order: 2")
>
> print("Thank you! You ordered:")
> if order == 1:
> print("- Hamburger")
> else:
> print("- Cheeseburger")
> if drink == 1 :
> print("- Coke")
> else:
> print("- Sprite")
>
> main ()
>
>
>
>
> -Jackie
> p.s: the error happens in the second if statement.
>
No it doesn't :) That's where it gets found, but the error is actually
before then, and as a learning exercise I'll let you find it. Look very
carefully at "order=..." and "drink=..." and I'm sure you'll spot the
difference.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list