By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,096 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,096 IT Pros & Developers. It's quick & easy.

Python invalid syntax error

P: 3
Expand|Select|Wrap|Line Numbers
  1. def main():
  2.  
  3.     months = ["January","Feburary","March","April","May","June","July","August","September","October","November","December"]
  4.  
  5.     SIZE = 12
  6.     rainForMonth = [] * SIZE
  7.     index,subNumHigh,subNumLow = 0,0,0
  8.     yearTotal, yearAverage, monthHighest, monthLowest = 0.0,0.0,0.0,0.0
  9.  
  10.     for index in range(SIZE):
  11.         print "Enter the amount of rainfall for the month of", months[index]
  12.         rainForMonth = float(raw_input(("Enter here: "))
  13.  
  14.     yearTotal = arraySum(rainForMonth,SIZE)
  15.     yearAverage = yearTotal / SIZE
  16.     monthHighest, subNumHigh = arrayHighestValue(rainForMonth,SIZE)
  17.     monthLowest, subNumLow = arrayLowestValue(rainForMonth,SIZE)
  18.  
  19.     print "Here are the results!"
  20.     print "Amount of rainfull for the year:", yearTotal
  21.     print "Average rainfall for the year:", yearAverage
  22.     print monthHighest, "had the most rainfall."
  23.     print monthLowest, "had the least rainfall."
  24.  
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.
Jul 12 '11 #1

✓ answered by Mariostg

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

Share this Question
Share on Google+
1 Reply


100+
P: 332
Error is not necessarily there though. You have unmatching brackets on line 12.
Jul 12 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.