Tell us what’s happening:
After typing the line 'apply_discount(100, 20), 80 was shown. However, when I clicked on ‘Check Your Code’, it kept telling me 'apply_discount(100, 20) should return 80. Which I believe is exactly what I had done, but it just won’t let me check and move on.
Your code so far
def apply_discount(price, discount):
if not isinstance (price, (int or float)):
return ('The price should be a number')
elif not isinstance(discount, (int or float)):
return ('The discount should be a number')
elif price<=0:
return('The price should be greater than 0')
elif discount<0 or discount>100:
return('The discount should be between 0 and 100')
print(price-(price*discount/100))
apply_discount(100,20)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
Challenge Information:
Build an Apply Discount Function - Build an Apply Discount Function