Build a Discount Calculator - Build a Discount Calculator

Tell us what’s happening:

i have done everything in the instruction and my code have not passed
what am i missing?
from step 8

Your code so far

def apply_discount(price, discount):
    if not isinstance(price, int or float):
        return 'The price should be a number'
    if not isinstance(discount, int or 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 discount should be between 0 and 100'
    else:
        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/144.0.0.0 Safari/537.36

Challenge Information:

Build a Discount Calculator - Build a Discount Calculator

1 Like

I think you misunderstood the subject.

In this lab you will write a function that calculates the final price of an item after applying a percentage discount.

1 Like

This syntax is not correct. You can find an example of how to check for multiple types here:

isinstance() method - Python - GeeksforGeeks

1 Like