Build a Discount Calculator - Build a Discount Calculator

Tell us what’s happening:

80
100
50
0
The price should be a number. I don’t know why the last print is not giving the expected value

Your code so far

def apply_discount(price,discount):
    if not isinstance(price, (int or float)):
        return('The price should be a number')
    if not isinstance (discount, (int or float)):
        return('The discount should be a number')   
    if price <= 0:
        return('The price should be greater than 0')
    if (0 > discount  or discount > 100):
        return('The discount should be between 0 and 100')

    discount_amount = price * (discount / 100)
    final_price = price - discount_amount
    
    return final_price
 
print(apply_discount(100,20))
print(apply_discount(200,50))
print(apply_discount(50,0))
print(apply_discount(1,100))
print(apply_discount(74.5,20))




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.4 Safari/605.1.15

Challenge Information:

Build a Discount Calculator - Build a Discount Calculator

This is not the correct syntax to use when checking for more than one type. Instead isinstance takes the value to check as the first parameter and a tuple of types (int, float) to check against as the second parameter.

Alright. Thank you.I’ve changed it and the code now passes