lundi 30 août 2021

If statement- python [closed]

I have this question in my H.W: Write a program that displays the discount that is applied to the number of phone accessories (each priced at 2.75 ) purchased according to this table: Quantity Discount 10‐19 10% 20‐49 20% 50‐99 30% 100+ 40%

and I wrote this code but it keeps telling me that there's something wrong..
''''

    accessories=(float(input("Enter the number of accessories purchased: "))
if accessories < 10:
 

    print("no discount, sorry!")

elif accessories >= 10 and accessories <=19:
 DISCOUNT10=(accessories*2.75*90)/100
 print(DISCOUNT10)
elif accessories >=20 and accessories <=49: 
  DISCOUNT20=(accessories*2.75*80)/100
 print(DISCOUNT20)
elif accessories >= 50 and accessories <=99:  
  DISCOUNT30= (accessories*2.75*70)/100
 print(DISCOUNT30)
else accessories >=100:
  DISCOUNT40= (accessories*2.75*60)/100
 print(DISCOUNT40)

''' can anyone help me?

Aucun commentaire:

Enregistrer un commentaire