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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!