[Practice] Inventory System
Submit solution
Python
Points:
10
Time limit:
0.3s
Memory limit:
20M
Author:
Problem type
Allowed languages
Inventory Management
You work for a small grocery store, and your task is to manage the inventory of products. You need to implement a program to track products, their quantities, and categories using Lists, Sets, and Tuples.
- Create a list of products, where each product is represented as a tuple containing (product_name, quantity, category).
- Create a set of unique product categories.
- Calculate and print the total quantity of each product category.
- Find and print the product with the highest quantity.
- Find and print the product with the lowest quantity.
Test Data
Input 1
4
Apples
100
Fruits
Bananas
50
Fruits
Milk
30
Dairy
Ladies Finger
70
Vegetables
Output 1
Total Quantity per Category:
- Dairy: 30
- Fruits: 150
- Vegetables: 70
Product with Highest Quantity: ('Apples', 100, 'Fruits')
Product with Lowest Quantity: ('Milk', 30, 'Dairy')
Input 2
4
Apples
234
Fruits
Mangos
342
Fruits
Milk
0
30
Dairy
Cabbage
-3
10
Vegetables
Output 2
Quantity cannot be Zero or Negative for Milk
Quantity cannot be Zero or Negative for Cabbage
Total Quantity per Category:
- Dairy: 30
- Fruits: 576
- Vegetables: 10
Product with Highest Quantity: ('Mangos', 342, 'Fruits')
Product with Lowest Quantity: ('Cabbage', 10, 'Vegetables')
Comments