I’m trying to figure out why my code isn’t passing the 4th test because I wrote if the discount variable is not an integer or a float in multiple different ways and it doesn’t want to complete the test can anyone tell me please what I’m doing wrong?
Your code so far
def apply_discount(price, discount):
if price is not int or float:
return('The price should be a number')
if discount != (int or float):
return 'The discount should be a number'
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Build a Discount Calculator - Build a Discount Calculator
def apply_discount(price, discount):
if price is not int or float:
return('The price should be a number')
if isinstance(discount, int) is False:
return 'The discount should be a number'
if isinstance(discount, float) is False:
return 'The discount should be a number'
def apply_discount(price, discount):
if (price is not int) or (price is not float):
return('The price should be a number')
if isinstance(discount, int) is False:
return 'The discount should be a number'
if isinstance(discount, float) is False:
return 'The discount should be a number'