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

How to fix syntax error message?

P: 1

I apologize if this seems like a silly question, but I am a new user of python, never programmed before. I am writing a simple program and I get an "invalid syntax" message concerning this line of code:

when I try to run the program the only message I am given is this exactly:
"There's an error in your program, invalid syntax"

the word [monthlySales] at the beginning of that line of code is highlighted pink.

This is for an assignment, and try as I might, I just cannot figure it out on my own...

Any help or insight would be greatly appreciated!!

Jan 22 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851

That is invalid syntax. You cannot make an assignment inside brackets. Example:
Expand|Select|Wrap|Line Numbers
  1. >>> N = 23
  2. >>> [N = float(N)]
  3. Traceback (  File "<interactive input>", line 1
  4.     [N = float(N)]
  5.        ^
  6. SyntaxError: invalid syntax
  7. >>> N = float(N)
  8. >>> N
  9. 23.0
  10. >>> 
Jan 23 '11 #2

Post your reply

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