Python invalid syntax error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Noah J
    New Member
    • Apr 2011
    • 3

    Python invalid syntax error

    Code:
    def main():
    
        months = ["January","Feburary","March","April","May","June","July","August","September","October","November","December"]
    
        SIZE = 12
        rainForMonth = [] * SIZE
        index,subNumHigh,subNumLow = 0,0,0
        yearTotal, yearAverage, monthHighest, monthLowest = 0.0,0.0,0.0,0.0
        
        for index in range(SIZE):
            print "Enter the amount of rainfall for the month of", months[index]
            rainForMonth = float(raw_input(("Enter here: "))
    
        yearTotal = arraySum(rainForMonth,SIZE)
        yearAverage = yearTotal / SIZE
        monthHighest, subNumHigh = arrayHighestValue(rainForMonth,SIZE)
        monthLowest, subNumLow = arrayLowestValue(rainForMonth,SIZE)
    
        print "Here are the results!"
        print "Amount of rainfull for the year:", yearTotal
        print "Average rainfall for the year:", yearAverage
        print monthHighest, "had the most rainfall."
        print monthLowest, "had the least rainfall."
    The problem is with line 14. I try to run the program and it highlights the totalYear variable in line 14 saying that it is an invalid syntax. Nothing looks wrong to me.

    Update****

    Just had to fix my parenthesis in line 12.
    Last edited by Noah J; Jul 12 '11, 03:08 PM. Reason: adding fix
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    Error is not necessarily there though. You have unmatching brackets on line 12.

    Comment

    Working...