if selection == "99": break elif selection in items_inventory.keys(): print(f"You have purchased {items_inventory[selection]} for ${items_price[selection]}") total_cost += items_price[selection] shopping_cart.append(items_inventory[selection]) else: print("Invalid selection, please try again.")
How can we add this to our while loop inside our ShoppingCartApplication class? Remember, all you need to use is:
– self.menu_items dictionary attribute to get item names and prices
– self.menu attribute to help see what each price and name means