Bird
0
0

Consider this code snippet for applying a coupon discount:

medium📝 Analysis Q13 of 15
LLD - Design — Online Shopping Cart
Consider this code snippet for applying a coupon discount:
price = 100
coupon_discount = 15  # fixed amount
final_price = price - coupon_discount
print(final_price)

What will be the output?
A85
B15
C100
D115
Step-by-Step Solution
Solution:
  1. Step 1: Understand the variables

    Price is 100, coupon_discount is 15 fixed amount.
  2. Step 2: Calculate final price

    final_price = 100 - 15 = 85.
  3. Final Answer:

    85 -> Option A
  4. Quick Check:

    100 - 15 = 85 [OK]
Quick Trick: Subtract fixed coupon value from price [OK]
Common Mistakes:
  • Confusing discount as percentage
  • Adding instead of subtracting discount
  • Printing coupon_discount instead of final price

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes