473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2615
Mariostg
332 100+
Error is not necessarily there though. You have unmatching brackets on line 12.
Jul 12 '11 #2

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

Similar topics

11
by: Andreas Neudecker | last post by:
Hello. I am relatively new to Python and I have a strange problem with some code. In a class the __call__ method gets parameters like this: class WhatsUp: __call__ ( self, var1,
7
by: Petr Prikryl | last post by:
Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error". Current situation: try... (Python 2.4 (#60, ...)) >>> i =...
4
by: Bradley Kite | last post by:
Hi all. I'm trying to diagnose/solve a problem with internet explorer, whereby sometimes the form submits, and other times IE produces an 'invalid syntax' error. First, I have a form, and...
0
by: Mark Phanides | last post by:
My ASP.NET application intermittantly (but always at same point) redirects to the 'Invalid Syntax Error' web page for some unknown reason. I've created a ASP.NET application written in VB.NET with...
5
by: DIBS | last post by:
I'm new to Python and I don't understand what I'm doing wrong. I'm running windows xp. In the command line window, I type: Python Sudoku.py and I get the response" SyntaxError: invalid...
2
by: py | last post by:
Hi, I am running python 2.4.2 on win xp pro. I have the WMI module from Tim Golden (http://tgolden.sc.sabren.com/python/wmi.html). I have some code which does this... MyScript.py...
5
by: Sheldon | last post by:
Hi Everyone, I am new here but I am pretty good at python programming but I am not exert. I have been away from programming for about a year and now I am programming in python again in...
10
by: ronrsr | last post by:
no matter where I place this imported file,the statement after it in the main program gets a syntax error, regardless of the syntax. I think I may have changed something in this file, but I'm...
10
by: jonathanemil | last post by:
Hello, I am a 1st semester Computer Science student in a Python class. Our current assignment calls for us to read a list from a file, create a 2-dimensional list from the file, and check to see...
3
by: kakarot vegeta | last post by:
There 's an invalid syntax error but i don't know what's wrong with it. the error says Invalid syntax: print variation_string import itertools variations = itertools.product('ab',...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.