Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

print(' =========================================') print(' Welcome to the ***PIZZA KINGDOM***') print('========================================= ') name=str(input('Please enter your name: ')) # First question: print(f' Hello {name}! What would you like

print(' =========================================') print(' Welcome to the ***PIZZA KINGDOM***') print('========================================= ')

name=str(input('Please enter your name: '))

# First question: print(f' Hello {name}! What would you like to order? ') print ('(1) Personal Pizza $5.00') print ('(2) Medium Pizza $5.00') print ('(3) Large Pizza $7.00')

user_input1= int(input('Enter your selection: ')) if user_input1==1: total_1=5.00 item_1=str(''personal pizza) elif user_input1==2: total_1=5.00 item_1=str('medium pizza') elif user_input1==3: total_1=7.00 item_1=str('large pizza') else: print('You did not choose a valid option') print('Try again') # Second question: print (' Would you like to add any of the following toppings? ')

print ('(1) pepperoni + $1.00') print ('(2) broccoli+ $0.50') print ('(3) No topping + $0.00')

user_input2=int(input('Enter your selection: '))

if user_input2==1: total_2=1.00 item_2=str('peperoni') elif user_input2==2: total_2=0.5 item_2=str('broccoli') elif user_input2==3: total_2=0 item_2=str('No toppings')

else: print('You did not choose a valid option') print('Try again')

# Third question: print (' Lastly, what would you like to drink? ')

print ('(1) Coke + $2.00') print ('(2) Orange juice + $1.50') print ('(3) Watter + $1.00') user_input3=int(input('Enter your selection: '))

if user_input3==1: total_3=2.00 item_3=str('Coke') elif user_input3==2: total_3=1.50 item_3=str('Orange juice') elif user_input3==3: total_3=1.00 item_3=str('Watter')

else: print('You did not choose a valid option') print('Try again') total=total_1+total_2+total_3 # sum of the cost of each selected item

item_review=str(f'{item_1} + {item_2} + {item_3}') # order review

print (' Your order details:', (item_review)) print ('Your total is $%.2f' % (total)) print (' Thanks for your order!')

How to fix this code so that if the user choose a invalid option (e.g 4) still works.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions