I need to write a program in Python using def to calculate if it would be profitable to buy a customer card for a discount or not (meaning that the purchase cost after discount + card price is less or equal to the original cost) with the following arguments: total purchase amount in euros, discount percent with customer card and customer card price. If the card saves the customer some x amount of euros then the function should return x. If purchase + card price is more expensive than the original purchase price then return -x, where x is the number of euros it’s cheaper with the card. The output should be something like that: Total purchase amount: 200 Discount percent: 5 Customer card price: 5 It’s better to get a card, you will save 5 euros So far I manage to write this code but I don't know what to do next:
def customer_card_discount1(total_purchase_amount1, discount_percent1, customer_card_price1):
new_price = (total_purchase amount1) * (100 - discount_percent1)/100 +
(customer_card_price1)
if new_price <= total_purchase amount1:
return customer_card_price1 - new_price
elif new_price > total_purchase amount1:
return customer_card_price1 - new_price
try:
total_purchase_amount1 - int(input("Total purchase amount"))
discount_percent1 - int(input("Discount percent"))
customer_card_price1 - int(input("Customer card price"))