Build a Discount Calculator - Build a Discount Calculator

Tell us what’s happening:

Ive not completed the tasks and its saying otherwise i really need to know if my code works and its saying ive completed the assignment

Your code so far

def apply_discount(price, discount):
    if type(price) != int and type(price) != float:
        return "The price should be a number"
    elif type(discount) != int and type (discount) != 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"
   
    def percentage(discount,price):
        return price * (discount/100)

    final_price = price - percentage(discount, price)
    return final_price
apply_discount(100, 20)
    

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Discount Calculator - Build a Discount Calculator

why do you think that you have not completed the assignment? which part of the requirements is your code not meeting?

From requirement 8 i havent written them

I think you are talking about the tests.

You need to implement the 8 User Stories, which you have done. If you have implemented them correctly, you will pass all of the tests, which you have.

Again, those are Tests not steps.

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