First page Back Continue Last page Overview Graphics

The map Function

The advantage of the lambda Operator can be seen in combination with the map-Function.

r = map(func, seq)

map applies the function func on all the elements of the sequence seq.

def fahrenheit(T):

return ((float(9)/5)*T + 32)

def celsius(T):

return (float(5)/9)*(T-32)

temp = (36.5, 37, 37.5,39)

F = map(fahrenheit, temp)

C = map(celsius, F)