Tell us what’s happening:
Hello! I have been on this problem for hours - it return everything right on my console, dass the tests fail - any ideas? Thanks in advance!
Your code so far
def apply_discount(price, discount):
if not isinstance(price, (int, float)):
print("The price should be a number")
return
elif not isinstance(discount, (int, float)):
print("The discount should be a number")
return
elif price <= 0:
print("The price should be greater than 0")
return
elif discount < 0 or discount >100:
print("The discount should be between 0 and 100")
return
else:
final_price = price * ((100 - discount) / 100)
print("Final Price:", final_price)
return
apply_discount(100, 20)
apply_discount(200, 50)
apply_discount(50, 0)
apply_discount(100,100)
apply_discount(74.5,20)
apply_discount('hello',25)
apply_discount(25,'banana')
apply_discount(0,50)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Safari/605.1.15
Challenge Information:
Build an Apply Discount Function - Build an Apply Discount Function