cost = 0 name = input ('What is your Name?') sandwich = input ('What sandwich do you want? Here are your choices, chicken $5.25, beef $6.25, tofu $5.75. Please type in all lowercase letters.') if sandwich == 'tofu': print ( name + ' wants a Tofu sandwich, that costs $5.75') cost == cost + 5.75 elif sandwich == 'chicken': print ( name + ' wants a Chicken sandwich, that costs $5.25') cost == cost + 5.25 elif sandwich == 'beef': print ( name + ' wants a Beef sandwich, that costs $6.25') cost == cost + 6.25 else: print('You need to order a sandwich or you get nothing. Bye') userdrink = input ('Would you like a drink? yes or no. Please type in all lowercase letters.') if userdrink == "yes": input ("What size drink would you like? Your options are small $1.00 medium $1.75 large $2.25. Please type in all lowercase letters.") if userdrink == 'small': print ( name + 'wants a small drink, that costs $1.00') cost == cost + 1.00 elif userdrink == 'medium': print ( name + 'wants a medium drink, that costs $1.75') cost == cost + 1.75 elif userdrink == 'large': print ( name + 'wants a large drink, that costs $2.25') cost == cost + 2.25 else: print('No size no drink, and you said drink so no order. Bye') else: print ("Okay no drink for " + name) userfries = input ('Would you like a fries? yes or no. Please type in all lowercase letters.') if userfries == "yes": input ("What size fries would you like? Your options are small $1.00 medium $1.50 large $2.00. Please type in all lowercase letters.") if userfries == 'small': print ( name + 'wants a small fry, that costs $1.00') cost == cost + 1.00 elif userfries == 'medium': print ( name + 'wants a medium fry, that costs $1.50') cost == cost + 1.50 elif userfries == 'large': print ( name + 'wants a large fry, that costs $2.00') cost == cost + 2.00 else: print('No size no fry, and you said fry so no order. Bye') else: print ("Okay no fry for " + name) print ('Cost so far is ' + cost) userketchup = input('How many packets of ketchup would you like? Please type in only numbers.') cost== (userketchup * 0.25) + cost if (userfries == "yes")(userdrink== "yes"): cost == cost - 1.00 else: cost == cost - 0.00 if (userfries == "yes") (userdrink == "yes"): print ("Your ordered a sandwich, a drink and a fry.") elif
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question