Build a Discount Calculator - Build a Discount Calculator

Tell us what’s happening:

can’t pass step. 6 (if discount is less then 0 but greater than 100 return…

Your code so far

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

    if discount <= 0 or discount >= 100:
        return 'The price should be greater than 0'

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Discount Calculator - Build a Discount Calculator

If discount is less than 0 or greater than 100

If you read your if statement out loud to yourself, is it doing what the instructions ask?

Also, the message you are returning for that validation is not what is asked.

i also tried if discount < 0 or discount > 100 if thats what you meant

Good. Now change the validation message.

omg I am stupid thanks just did

You are not stupid; you are learning…and that’s pretty smart!

1 Like