Tell us what’s happening:
It keeps marking the test 3 and 4 as a fail even when the return is there.
Your code so far
price = input("What's the item's price?")
discount = input ("What's the item's discount?")
def apply_discount(price, discount):
try:
price = float(price)
except:
return("The price should be a number")
try:
discount = float(discount)
except:
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")
return(price * (1 - discount/100))
return(final_price)
print(apply_discount(price,discount))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0
Challenge Information:
Build an Apply Discount Function - Build an Apply Discount Function