Skip to main content

Map Function in Python

 



b=[0,1,2,3,4,5,6]
def sq(a):
    return a*a

def cube(a):
    return a*a*a

fun = [sq , cube]
for i in b:
    val = list(map(lambda x:x(i) ,fun))
    print(val)




Comments