python newbie question

Bruce Sass bsass at freenet.edmonton.ab.ca
Thu Jul 19 02:55:31 EDT 2001


On Thu, 19 Jul 2001 donmalla at yahoo.co.in wrote:

> Hi All,
> I am a newbie to python. I am following the "Diving into Python
> tutorial".
> However I am having a problem with the for loop
> Here is the problem:
>
> >>> vec = [2,4,6]
> >>> [3*x for x in vec]
> SyntaxError: invalid syntax
<...>
> Please help me. I am using Python 1.5 on Windows 2000.

You need Python 2.0 or newer to use [list comprehensions].


-Bruce





More information about the Python-list mailing list