Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

How would I modify this Python Program to include two different if statement structures? For this program, decisions may include adding different charges to a

How would I modify this Python Program to include two different if statement structures? "For this program, decisions may include adding different charges to a tables' check based on what the diner orders, and/or deciding when to quit the program, among other possibilities. "

def display_menu_items(): print("item cost") print("1.item-1 5") print("2.item-2 10") print("3.item-3 15") print("4.item-4 50") print("5.item-5 25") print("6.item-6 2") print("7.item-7 26")

def main(): print("Enter -1 to quit manager or any other number to continue") enter_to_quit=int(input()) if (enter_to_quit==-1): quit() print("enter table number") table_number=int(input()) print("enter no.of diners (maximum limit 4)") number_of_diners=int(input()) print("select an item and enter -1 to exit") items=[] item_number=[] select=0 ch=[0,5,10,15,50,25,2,26] display_menu_items() while ( select is not -1): items.append(ch[select]) item_number.append(select) select=int(input()) total_items_cost=0 for i in items: total_items_cost=total_items_cost+i print("Total cost without tax =",total_items_cost) total_cost=total_items_cost+(total_items_cost/100)*8 print("cost for individual diner =",total_cost/number_of_diners) print("total cost with tax = ",total_cost) print("suggestions for tip 1.10% 2.15% 3.20% 4.25% ") tip=int(input()) tip_list=[10,15,20,25] total_tip=tip_list[tip] total_tip=(total_cost/100)*total_tip print("table information") print("table no:- ",table_number) print("selected items:-") item_list=["item-1","item-2","item-3","item-4","item-5","item-6","item-7"] for i in range(1,len(items)): print(item_list[item_number[i]-1]) print("total cost= ",total_cost) print("tip= ",total_tip) print("total cost with tip= ",total_cost+total_tip) main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions