Tell us what’s happening:
Describe your issue in detail here.
the code I have written doesn’t want to work at all
Your code so far
def apply_discount(price , discount):
if not isinstance(price,(int or float)):
return "The price should be a number."
if not isinstance(discount,(int or float)):
return "The discount should be a number."
if price <= 0:
return "The price should be greater than 0."
if discount <0 or discount > 100:
return "The discount should be between 0 and 100."
discount_result = price * discount/100
final_price = price - discount_result
return final_price
print(apply_discount(100,20))
Your mobile information:
XBOOK_12 - Android 14 - Android SDK 34
Challenge: Build an Apply Discount Function - Build an Apply Discount Function
Link to the challenge: