Answer to Question #265308 in Python for Muaath Muqibel

Question #265308

the website, you get a 10% discount if you are a member. Additionally, you are also getting a discount of 5% on the item because its Father’s Day.

Write a function that takes as input the cost of the item that you are purchasing and a Boolean variable indicating whether you are a member (or not), applies the discounts appropriately, and returns the final discounted value of the item.

Note: The cost of the item need to be an integer


1
Expert's answer
2021-11-13T01:18:21-0500
def get_discounted_cost(original_cost: int, is_member: bool) -> int:
    discount_member = 0.1
    discount_fathers_day = 0.05

    if is_member:
        discount = discount_member + discount_fathers_day
    else:
        discount = discount_fathers_day

    discounted_cost = original_cost * (1 - discount)
    discounted_cost = int(discounted_cost)
    return discounted_cost

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS