So I have to write a program that takes the amount and weight of pumpkins entered by a person and then outputs them back with their corrisponding weight class that i specify. I keep getting a syntax error on the elif statement and I was wondering if i could have some guidance as to what I'm doing wrong. The code is listed below, Thank you in advance !

def intro():

    print("Program to calculate the average of a")
    print("group of pumpkin weights.")
    print("You will be asked to entr the number of")
    print("pumpkins, followed by each pumpkin weight.")
    print("Written by Gregory Navestad.")
    print()

def pumpkinAmount():

    pumpkinNumber = int(input("Enter the number of pumpkins: "))
    print()
    print()
    totalWeight = 0
    count = 0
    for pumpkins in range(pumpkinNumber):
        count = count +1
        pumpkinWeight = int(input("Enter the weight for pumpkin " +str(count)+": "))
        totalWeight = totalWeight + pumpkinWeight
        if (pumpkinWeight >= 70.00):
            print(str(pumpkinWeight + " is heavy")
        elif (pumpkinWeight >= 50.00 and pumpkinWeight <= 70):
            print(str(pumpkinWeight + " is normal")
        else: (pumpkinWeight <= 50.00):
            print(str(pumpkinWeight + " is light")
    return totalWeight,pumpkinNumber

def calcAverage(totalWeight,pumpkinNumber):

    averageWeight = float(totalWeight) / float(pumpkinNumber)
    return averageWeight

def results(averageWeight,pumpkinNumber):
    print("The Average weight of",pumpkinNumber,"is {0:0.3f}".format(averageWeight))
    print()

def  main():
        intro()
        totalWeight, pumpkinNumber = pumpkinAmount()
        averageWeight = calcAverage(totalWeight,PumpkinNumbers)
        results()
main()

You don't have the correct number of closing brackets to match the opening ones one the print lines.
Lines 22, 24 and 26 are all one short.

Also, the last 'else' should be another elif to work properly. That or remove the condition for that line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.