vendredi 9 août 2019

Python if-else-elif statement with discount

i'm new to programming language and our prof gave us a problem using the if statement. I'm having a problem as to why is my discount not showing up

(i tried diff types of computing but i can't really figure the what's the problem)

donut = int(input("Welcome! How many donuts would you like to order?"))

price = 12.75*donut
bulk = donut//120

if donut >= 1:
    print("Your total amount is", price)
if donut >120:
    print("Your total amount is", price-(price*0.02))
if bulk==1 and donut==120:
    print("Your total amount is", price * 0.04)
elif donut >= 360:
    print("Your total amount is", price * 0.06)
elif donut >= 480:
    print("Your total amount is", price * 0.08)
elif donut >= 600:
    print("Your total amount is", price * 0.10)
elif donut >= 720:
    print("Your total amount is", price * 0.12)
elif donut >= 840:
    print("Your total amount is", price * 0.14)
elif donut >= 960:
    print("Your total amount is", price * 0.16)
elif donut >= 1080:
    print("Your total amount is", price * 0.18)
elif donut > 1200:
    print("Your total amount is", price * 0.20)

Aucun commentaire:

Enregistrer un commentaire