Build an Apply Discount Function - Build an Apply Discount Function

Tell us what’s happening:

whole program is working only error is coming in step 9 can you help me please to figure out the problem

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Build an Apply Discount Function - Build an Apply Discount Function

test your function, add print(apply_discount(50, 0)), see what it returns

Does this conditional make sense based on the message it returns?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.