LLD - Design — Online Shopping CartWhich of the following is the correct way to represent an inventory item with quantity in a dictionary in Python?A{'item': 'apple', 'quantity': 10}B['apple', 10]C('apple', 10)D'apple': 10Check Answer
Step-by-Step SolutionSolution:Step 1: Identify dictionary syntax in PythonDictionaries use key-value pairs inside curly braces.Step 2: Check options for correct dictionary format{'item': 'apple', 'quantity': 10} uses keys and values properly with curly braces.Final Answer:{'item': 'apple', 'quantity': 10} -> Option AQuick Check:Dictionary syntax = {'item': 'apple', 'quantity': 10} [OK]Quick Trick: Dictionaries use curly braces with key-value pairs [OK]Common Mistakes:MISTAKESUsing list or tuple instead of dictionaryMissing curly braces for dictionary
Master "Design — Online Shopping Cart" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Design — Chess Game - Piece movement rules (polymorphism) - Quiz 9hard Design — Food Delivery System - Rating and review system - Quiz 13medium Design — Food Delivery System - Rating and review system - Quiz 3easy Design — Food Delivery System - Why delivery systems test service coordination - Quiz 12easy Design — Hotel Booking System - Hotel, Room, Booking classes - Quiz 7medium Design — Hotel Booking System - Hotel, Room, Booking classes - Quiz 6medium Design — Hotel Booking System - Hotel, Room, Booking classes - Quiz 11easy Design — Hotel Booking System - Room type hierarchy - Quiz 9hard Design — Splitwise (Expense Sharing) - Split strategies (equal, exact, percentage) - Quiz 12easy Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 4medium