syntax error in sum(). Please explicate.
Tim Peters
tim.peters at gmail.com
Sat Nov 18 18:46:54 EST 2006
[Matt Moriarity]
>> try surrounding your sum argument in brackets:
>>
>> sum([phi(x // ps[i+1], i) for i in range(a)])
>>
>> instead of:
>>
>> sum(phi(x // ps[i+1], i) for i in range(a))
[Michael Press]
> Thank you. That makes it work.
But is a wrong solution ;-) As others have suggested, it's almost
certainly the case that you were using a too-old version of Python.
2.5 is current, and 2.4.4 (the current bugfix release in the 2.4 line)
would also work. You must have been using a version before 2.4, and
if you're just starting with Python, it's a Bad Idea to artificially
burden yourself with an old version where current examples can't work
;-)
More information about the Python-list
mailing list