Invalid syntax error

Andrew Berg bahamutzero8825 at gmail.com
Sat Mar 10 07:46:28 EST 2012


On 3/10/2012 6:34 AM, sl33k wrote:
> I'm trying project euler problem 3 and I've hit the wall with this
> error. What could be the problem here?
> 
>  l=[]
>>>> num=600851475143
>>>> i=1
>>>> while i<=num:
> ...     if num%i==0:
> ...         l.append(i)
> ...     i+=1
> ... print max(l)
>   File "<stdin>", line 5
>     print max(l)
>         ^
> SyntaxError: invalid syntax
> 
> 
You must be using Python 3. Along with many, many other changes, Python
3 uses a print function instead of a print statement. If you want to
follow along with the problems, use the version of Python it uses (2.7
is probably safe if there isn't a version specified).

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640



More information about the Python-list mailing list