Apply Multiple Discounts
Medium📝 Description
Apply discounts based on cart total: 10% if total > $100, else 5%.
Input Format
[{"name": str, "price": float}] (list of products)
Output Format
float (final price after discount)
Constraints
1 ≤ number of products ≤ 1000, 0 < price ≤ 10^6
🔍 Sample Input
[{"name": "Laptop", "price": 1000}]
✅ Sample Output
900.0
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run