I have no idea why my function is not returning some but again returning some
Your code so far
def apply_discount (price,discount):
if not isinstance(price,(int,float)):
return ("The price should not be a number")
if not isinstance(discount,(int,float)):
return ("The discount should not be a number")
if price <= 0:
return ("The price should be greater than 0")
if not 0 <= discount >= 100:
return ("The discount should be between 0 and 100")
discount_amount = price * (discount / 100)
final_price = price - discount_amount
return final_price
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15
Challenge Information:
Build a Discount Calculator - Build a Discount Calculator
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Get Help > Ask for Help button located on the challenge.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
Please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.
The easiest way to create a topic for help with your own solution is to click the Ask for Help button located on each challenge. This will automatically import your code in a readable format and pull in the challenge url while still allowing you to ask any question about the challenge or your code.