lundi 10 février 2020

If statement in python not working however else value is returned

I have question. I don't understand why the code isn't executed. Only the else value is returned. Please help. Huge desperation. Thank you in advance!

def discounted_price(unit_price,quantity):
    if unit_price >= 200:
        discounted_price=(0.9*unit_price)*quantity
    elif quantity >= 20 and quantity%5==0: 
        discounted_price=unit_price*(quantity-(quantity/5))
    elif quantity >= 20:
        discounted_price=unit_price*(quantity-int(quantity/5))
    else:
        discounted_price=unit_price*quantity
        return discounted_price

Aucun commentaire:

Enregistrer un commentaire