Linked Questions

Popular Questions

This is my code:

filter(lambda n,r: not n%r,range(10,20))

I get the error:

TypeError: <lambda>() takes exactly 2 arguments (1 given)

So then I tried:

foo=lambda n,r:not n%r

Which worked fine. So I thought this will work:

bar=filter(foo,range(10,20))

but again:

TypeError: <lambda>() takes exactly 2 arguments (1 given)

Something similar happens for map as well. But reduce works fine. What am I doing wrong? Am I missing something crucial needed in order to use filter or map?

Related Questions