Tell us what’s happening:
I can’t figure out why it doesn’t like my functions output as it matches what the stories have asked for? I have read all of the recent posts with the same issue as me but I must be simple because I still cant figure it out, please help!
Your code so far
def apply_discount(price, discount):
if not isinstance(price, (int, float)):
print("The price should be a number")
elif price <= 0:
print("The price should be greater than 0")
elif not isinstance(discount, (int, float)):
print("The discount should be a number")
elif discount <0:
print("The discount should be between 0 and 100")
elif discount >=101:
print("The discount should be between 0 and 100")
else:
print(price * (100 - discount) / 100)
apply_discount("20", 20)
apply_discount(20, "20")
apply_discount(-1, 20)
apply_discount(20, -1)
apply_discount(100, 20)
apply_discount(200, 50)
apply_discount(50, 0)
apply_discount(1, 100)
apply_discount(74.5, 20.0)
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Discount Calculator - Build a Discount Calculator