Newbie to python. Very newbie question

ReviewBoard User lalitha.viswanath at gmail.com
Sun Apr 7 07:16:27 EDT 2013


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



More information about the Python-list mailing list