samedi 5 juin 2021

invalid syntax at '{' not sure where to fix [closed]

the codes is a while loop to calculate number of boxes to ship, output gives back invalid syntax at the first if statement's "{". I'm not sure where the fault may be, can anyone spot the error? Much appreciative!

PRICEPERBOX=6
boxesshipped=0
totalprice=0
totalboxesshipped=0
boxesordered=0
pricebeforediscount=0
response = input("do you wish to process a customer? Enter yes or no?").lower()
while response == "yes":
    customer_id=input("Enter the customer's id: ")
    boxesordered=int(input("Enter the number of boxes ordered: "))
    if (boxesordered >= 9) and (boxesordered <= 24){
        pricebeforediscount = PRICEPERBOX * boxesordered
        boxesshipped+=boxesordered+1
        totalprice+=pricebeforediscount}
    elif (boxesordered >= 25) and (boxesordered <= 50){
        pricebeforediscount = PRICEPERBOX * boxesordered
        discount=0.15*pricebeforediscount
        totalprice+=pricebeforediscount-discount
        boxesshipped+=boxesordered+2}
    elif (boxesordereed > 50){
        pricebeforediscount = PRICEPERBOX * boxesordered
        discount=0.15*pricebeforediscount
        totalprice+=pricebeforediscount-discount
        for boxes in range (boxesordered, 0, -50):  
            boxesshipped+=boxesordered+2}
    else{
        print("invalid input")}

Aucun commentaire:

Enregistrer un commentaire