Question
Write Python codes to develop a product recording system. It should allow the user to type product names one by one until he enters an
Write Python codes to develop a product recording system. It should allow the user to type product names one by one until he enters an empty product name. Display entered product names and quantities so that each line is formatted as "---[product name]: [quantity]." For example, a user types 'beef', 'beef', 'milk', 'steak', 'tomato', 'potato', 'milk', 'tomato', 'potato', 'beef'. Your program should display at the end:
The products you entered and quantities are:
---beef: 3
---milk: 2
---steak:1
---tomato: 2
---potato: 2
Note: the order of product names does not matter.
Hint: Use a dictionary to take a record of the product and update the quantity; using a for loop to display products and quantities.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started