LLD - Design — Online Shopping CartWhich syntax correctly applies a 10% discount to a price variable in Python?Adiscounted_price = price - 10Bdiscounted_price = price + 0.1Cdiscounted_price = price / 10Ddiscounted_price = price * 0.9Check Answer
Step-by-Step SolutionSolution:Step 1: Understand percentage discount calculationA 10% discount means paying 90% of the price, so multiply by 0.9.Step 2: Check each optionOnly multiplying price by 0.9 correctly applies 10% off.Final Answer:discounted_price = price * 0.9 -> Option DQuick Check:10% off = multiply by 0.9 [OK]Quick Trick: Multiply price by (1 - discount%) to apply discount [OK]Common Mistakes:MISTAKESAdding discount instead of subtractingDividing price incorrectly
Master "Design — Online Shopping Cart" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Advanced LLD Concepts - Event-driven design - Quiz 1easy Design — Chess Game - Why chess tests polymorphism and strategy - Quiz 9hard Design — Chess Game - Why chess tests polymorphism and strategy - Quiz 4medium Design — Food Delivery System - Order tracking state machine - Quiz 10hard Design — Food Delivery System - Notification to all parties - Quiz 1easy Design — Hotel Booking System - Availability checking - Quiz 7medium Design — Hotel Booking System - Search and filter design - Quiz 1easy Design — Hotel Booking System - Room type hierarchy - Quiz 10hard Design — Online Shopping Cart - Why e-commerce tests real-world complexity - Quiz 2easy Design — Splitwise (Expense Sharing) - User, Group, Expense classes - Quiz 10hard