469,361 Members | 2,276 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

Python invalid syntax error

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.

1 2544
Mariostg
332 100+
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.

Similar topics

11 posts views Thread by Andreas Neudecker | last post: by
7 posts views Thread by Petr Prikryl | last post: by
4 posts views Thread by Bradley Kite | last post: by
reply views Thread by Mark Phanides | last post: by
5 posts views Thread by DIBS | last post: by
2 posts views Thread by py | last post: by
5 posts views Thread by Sheldon | last post: by
10 posts views Thread by ronrsr | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.