Bird
Raised Fist0
HLDsystem_design~10 mins

Product catalog design in HLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the main component of a product catalog system.

HLD
class [1]:
    def __init__(self):
        self.products = []
Drag options to blanks, or click blank then click option'
APaymentGateway
BUserProfile
COrderManager
DProductCatalog
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing unrelated class names like UserProfile or PaymentGateway.
2fill in blank
medium

Complete the code to add a product to the catalog.

HLD
def add_product(self, product):
    self.products.[1](product)
Drag options to blanks, or click blank then click option'
Aappend
Bclear
Cremove
Dpop
Attempts:
3 left
💡 Hint
Common Mistakes
Using remove or pop which delete items instead of adding.
3fill in blank
hard

Fix the error in the method to find a product by ID.

HLD
def find_product(self, product_id):
    for product in self.products:
        if product.id == [1]:
            return product
    return None
Drag options to blanks, or click blank then click option'
Aproduct_id
Bproduct
Cself
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing product.id with product or self which are incorrect.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension for product names and prices where price is above 100.

HLD
{product.name: product.[1] for product in products if product.[2] > 100}
Drag options to blanks, or click blank then click option'
Aprice
Bname
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using name instead of price for the value or condition.
5fill in blank
hard

Fill all three blanks to create a filtered dictionary of product IDs and names for products in stock.

HLD
{product.[1]: product.[2] for product in products if product.[3] > 0}
Drag options to blanks, or click blank then click option'
Aid
Bname
Cstock
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Using price instead of stock for filtering or wrong attributes for keys/values.