products ={"laptop": 75000, "smartphone": 30000, "headphones": 5000, "keyboard": 3500, "mouse": 2000 } cart = [] def view_products(): for product, price in products.items(): print(f"{product}: ${price}") def add_to_cart(product_name): if product_name in products: cart.append(product_name) print(f"{product_name}(s) added to your cart.") else: print("Product not found.") def view_cart(): print("Your cart contains:") for product in cart: print(f"- {product}: ${products[product]}") def total_cart_value(): total = sum(products[product] for product in cart) print(f"Total value of your cart: ${total}") def exit_cart(): print("Exiting the shopping cart. Thank you for shopping with us!") while True: print("\nWelcome to the Shopping Cart!") print("1. View products") print("2. Add product to cart") print("3. View cart") print("4. Exit") user_choice = input("Enter your choice (1-4): ") if user_choice == "1": view_products() elif user_choice == "2": product_name = input("Enter the product name to add to cart: ") add_to_cart(product_name) elif user_choice == "3": view_cart() elif user_choice == "4": exit_cart() break else: print("Invalid choice. Please enter a number from 1 to 4. ")