Build an Apply Discount Function - Build an Apply Discount Function

Tell us what’s happening:

My code works and all the tests have been passed as shown on the terminal. However, the tests on the left are not being marked as complete. What do I do?

Your code so far

#We want to calculate the final price of an item after applying a percentage discount. 


def apply_discount(price,discount):
    if type(price) == str:
        print('The price should be a number')

    elif type(discount) == str:
        print('The discount should be a number')

    else:
        if price < 0 or price == 0:
            print('The price should be greater than 0')  

        elif discount < 0 or discount > 100:
            print('The discount should be between 0 and 100')
        
        else:
            calc_disc =  (discount/100) * price
            calc_final_price = price - calc_disc
            print('Your final price is:',calc_final_price)

apply_discount(100,20)
apply_discount(200,50)
apply_discount(50,0)
apply_discount(100,100)
apply_discount(74.5,20)
apply_discount('hello',25)
apply_discount(25,'banana')
apply_discount(0,50)






Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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

Welcome to the forum @Andrea_0723 ,

The function should return the final price after applying the discount.

Is your function returning the final price?

What if price is passed to the function as a boolean or a list, etc?

Happy coding!