Newbie to python. Very newbie question

Kruno Saho kruno.saho at gmail.com
Sun Apr 7 07:19:32 EDT 2013


On Sunday, April 7, 2013 9:16:27 PM UTC+10, ReviewBoard User wrote:
> Hi
> 
> I am a newbie to python and am trying to write a program that does a
> 
> sum of squares of numbers whose squares are odd.
> 
> For example, for x from 1 to 100, it generates 165 as an output (sum
> 
> of 1,9,25,49,81)
> 
> 
> 
> Here is the code I have
> 
> print reduce(lambda x, y: x+y, filter(lambda x: x%2, map(lambda x:
> 
> x*x, xrange
> 
> (10**6)))) = sum(x*x for x in xrange(1, 10**6, 2))
> 
> 
> 
> I am getting a syntax error.
> 
> Can you let me know what the error is?
> 
> 
> 
> I am new to Python and am also looking for good documentation on
> 
> python functions. http://www.python.org/doc/ does not provide examples
> 
> of usage of each function

Are you sure you do not mean '==' instead of '='?



More information about the Python-list mailing list