Complete the code to define the main component of a product catalog system.
class [1]: def __init__(self): self.products = []
The main class managing the product catalog should be named ProductCatalog.
Complete the code to add a product to the catalog.
def add_product(self, product): self.products.[1](product)
To add an item to a list in Python, use the append method.
Fix the error in the method to find a product by ID.
def find_product(self, product_id): for product in self.products: if product.id == [1]: return product return None
The method should compare product.id with the input parameter product_id.
Fill both blanks to create a dictionary comprehension for product names and prices where price is above 100.
{product.name: product.[1] for product in products if product.[2] > 100}The dictionary maps product names to their prices, filtering products with price > 100.
Fill all three blanks to create a filtered dictionary of product IDs and names for products in stock.
{product.[1]: product.[2] for product in products if product.[3] > 0}The dictionary uses product IDs as keys and names as values, filtering products with stock > 0.
