I have a line of code which is:
D = {'h' : 'hh' , 'e' : 'ee'}
str = 'hello'
data = ''.join(map(lambda x:D.get(x,x),str))
print data
this gives an output -> hheello
I am trying to understand how does map function work here. Does map take each character of the string and compare it with dictionary key, and give back the corresponding key value?
How does it do for each character here? There is no iteration. Is there any good example to understand this better?