Create a function in Python which takes a dict of shopping items and calculates
the final checkout price.
Conditions:
☐ If Age is less than 20 there is 25% discount on Books and Sports Item.
☐ All Electronics has a discount of 10% for all age groups.
☐ If Age is between 20 to 40, there is 25% discount on Home Supplies
Output:
☐ Updated prices with all the relevant discounts
Input:
sample input 1:
{
"name": "Clark",
"age": 19,
"cart": {"Books": 300, "Electronics": 2000, "Stationary": 100, "Sports Item": 1000}
}
Sample output 1:
age < 20
25% discount on books and 25% discount on sport item
Electronics 10% discount
Discounted Cart = {"Books": 225, "Electronics": 1800, "Stationary": 100, "Sports Item":
750}
Final billing amount = 225 + 1800 + 100 + 750 => 2875
in python
Answers
Answered by
4
Explanation:
nvxgkdgiftudhigydiydgjdjfxjtxiydtufhdiydiy
Similar questions
Geography,
1 month ago
Accountancy,
1 month ago
Science,
1 month ago
English,
2 months ago
Physics,
9 months ago