[Discount Calculator] Code-Review and Help

def apply_discount(price,discount):
    
    #Conditional to check if the price is a number
    if isinstance(price,int) or isinstance(price,float):

        is_price_number = True

        #Nested Conditional to check if the discount is a number
        if isinstance(discount,int) or isinstance(discount,float):

            is_discount_number = True
        else:
            is_discount_number = False
            print("The discount should be a number")
           
    else:
        is_price_number = False
        print("The price should be a number")
    
    #Conditional to Check Realistic Price
    if is_price_number:
        if price <= 0:
            is_price_real = False
            print("The price should be greater than 0")
        else:
            is_price_real = True


    #Conditional to Check Realistic Discount
    if is_discount_number:
        if discount <= 0 or discount > 100:
            is_discount_real = False
            print("The discount should be between 0 and 100")
        else:
            is_discount_real = True
              
    #Checks if discount and price is a number is true
    if (is_discount_number and is_price_number):
        
        #Check if is discount and price is reasonable
        if is_discount_real and is_price_real:
            
            price = price-(price * discount/100)
        else:
            pass
    else:
            print("Function failed")
    
    return price      

apply_discount(30,40)

Got the code working before but I accidentally exited the tab. I’ve tried using Ai to help me understand reasons why I am failing, but it seems to be rewriting my code instead of helping me understand why my bad code isn’t working.

when you ask for help it’s really helpful if you share the link to the challenge

in this case, here it is: https://www.freecodecamp.org/learn/python-v9/lab-discount-calculator/build-a-discount-calculator

Alright, first failed test:

When apply_discount is called with a price (first argument) that is not a number (int or float ) it should return The price should be a number .

what is your function returning in this case?
test it

print("actual:    ", apply_discount("", 97))
print("expected:  ", "The price should be a number")

what is it returning?