Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 11 years ago

fidbc gravatar image

You can try

map(lambda x: x%2,[4,3,2,1,1])

then

sum(map(lambda x: x%2,[4,3,2,1,1]))

will return the desired output.

What happens when you use mod(x,2) is that sage returns an element of Z2, however the % operator returns an Integer.