> What's the invalid syntax in the following code? I tried figuring it out > by myself, and I couldn't. > > The editor highlights the word year in the line: > > int year > > after I hit okay when this message pops up: > > Invalid syntax.
Hi Nathan, I would believe the editor. *grin* Python doesn't support saying declarative things like "int year": that's something that just doesn't translate from Java to Python. Just for your understanding: your environment is highlighting the word 'year' only because it really doesn't know what you're trying to do. In this particular case, Python thinks that you might be trying to apply the int() function on year, but in that case, you'd need parens, like: int(year) So that's why it's highlighting year: you're missing parens under this interpretation of the situation. But, as you know, it's completely misunderstanding things. Still, even though the error message is slightly inaccurate, it's correct in the sense that the problem is on that line: you don't predeclare variable or their types in Python. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor