Hi, I am trying my hands on lambda function and here is my code.

>>> a = [1,2,3,4]
>>> b = [17,12,11,10]
>>> map(lambda x,y:x+y, a,b)

And the output is :

< map object at 0xb7540eec >

So my question is why this map object output? Why not actual output that i want to see?

My python version: 3.2
OS: xubuntu xfce 4.8

Any ideas on how to get the output?

Many python functions which used to return lists now return iterables. You can convert it to a list with the list() constructor

list(map(lambda x,y:x+y, a,b))

This produces the same as

[x + y for x, y in zip(a, b)]

The use of map() is deprecated in favor of list comprehension.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.