Build an Apply Discount Function - Build an Apply Discount Function

Tell us what’s happening:

my output is correct, even the error messages. But when I check my code it fails to fulfill the requirements 5 and 6

Your code so far

def apply_discount(price, discount):
    print(price, type(price)) 
    print(discount, type(discount))
    if  not isinstance(price, (int, float)) or type(price) == bool:
        return 'The price should be a number'
    elif not isinstance(discount,(int, float)) or type(discount) == bool: 
        return 'The discount should be a number'    
    elif price<=0:
        return'The Price should be greater than 0'
    elif discount > 100 or discount < 0:
        print('The discount should be between 0 and 100')  
    else:
        discount_amount = discount/100 * price
        final_price = price - discount_amount
        return final_price
        print('Final Price:', final_price)

print(apply_discount(0, 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/146.0.0.0 Safari/537.36

Challenge Information:

Build an Apply Discount Function - Build an Apply Discount Function

The first failed test is

When apply_discount is called with a price lower than or equal to 0 , it should return The price should be greater than 0 .

You can test your function using this code, paste it below your function

print("actual,  ", repr(apply_discount(0, 40)))
print("actual,  ", repr(apply_discount(-5, 35)))
print("expected,", repr('The price should be greater than 0'))

do they match?

thank you so much, it showed me where it didn’t match! it works now