Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the code This is the question def menu(): # Print main menu till user checks out while True : print( 1 -

This is the code image text in transcribed

image text in transcribed

image text in transcribed

This is the question

image text in transcribed

image text in transcribed

def menu(): # Print main menu till user checks out  while True: print("  1 - Books  2 - Electronics   3 - Clothing  4 - Checkout ") print("  Select one of the categories or checkout (1-4): ",end=" ") option=int(input()) if(option>=1 and option return option def main(): # Category list  categories=["Books","Electronics","Clothing"] # number of items list for each category  noItems=[0,0,0] # list of cost for each category  cost=[0,0,0] # Price list for books, electronics and clothing  book_list=[19.95,24.50,18.95] electronic_list=[429,790,220] clothing_list=[9.50,45,24] while True: # option contains user returned option  option=menu() print() # Print sub-categories accordingly  if option==1: print("1. Origin , $19.95") print("2. Grant , $24.50") print("3. Prairie Fries , $18.95") print("4. No Selection") # Ask user to choose one option  print("  Select one of the books or nothing (1-4): ", end=" ") suboption=int(input()) # If sub option is between 1-3  # Increment noItems by 1 for books  # Add book cost in cost list  if (suboption >= 1 and suboption elif option == 2: print("1. Hp laptop, $429.50") print("2. EyePhone, $790.00") print("3. Bose 20 speakers, $220.00") print("4. No Selection") # Ask user to choose one option  print("  Select one of the electronic items or nothing (1-4): ", end=" ") suboption = int(input()) # If sub option is between 1-3  # Increment noItems by 1 for electronics  # Add electronic cost in cost list  if (suboption >= 1 and suboption elif option == 3: print("1. T-shirt, $9.50") print("2. Shoes, $45.00") print("3. Pants, $24.00") print("4. No Selection") # Ask user to choose one option  print("  Select one of the clothing items or nothing (1-4): ", end=" ") suboption = int(input()) # If sub option is between 1-3  # Increment noItems by 1 for clothing  # Add clothes cost in cost list  if (suboption >= 1 and suboption elif option == 4: print("Check out !!") break   # Prints summary  print(" Summary of shopping cart: ") print("  %-20s %-20s %-20s   "%("Category","Number of items","Cost of items")) for i in range(len(noItems)): if(noItems[i]!=0): print(" %-25s %-20d $%.1f "%(categories[i],noItems[i],cost[i])) print("  %-25s %-20d $%.1f  "%("Total",sum(noItems),sum(cost))) main() 
LA2py (3.6.2 File Edit Format Run Options Window Help t menu ) # Print main menu till user checks out while True: lectronics In 3 -clothingin 4 -Checkout In") print("inin 1 -Booksin 2 -E print ("in Select one of the categories or checkout (1-4): end option-int (input 0) it (option and option

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_2

Step: 3

blur-text-image_3

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

Students also viewed these Databases questions

Question

Conduct an effective performance feedback session. page 376

Answered: 1 week ago