Tell us what’s happening:
10/11 completed, why the Float numbers doesn’t working ?
Your code so far
price = input('Item price : ')
discount = input('Any discount ? ')
def apply_discount (price, discount):
if not isinstance (price, (int or float)):
return('The price should be a number')
elif not isinstance (discount, (int or 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 :
final_price = price * (1 - discount / 100)
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/17.6 Safari/605.1.15
Challenge Information:
Build an Apply Discount Function - Build an Apply Discount Function