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
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
Comments
Leave a comment