Posts

Showing posts with the label map

Map function in Python

Image
  The  map ()  function  executes a specified  function  for each item in a iterable. The item is sent to the  function  as a parameter. Code Example >>> l1 = [1, 2, 3, 4, 5] >>> l2 = [5, 4, 3, 2, 1] >>> l3 = [5, 4, 3, 2, 1] >>> def cal(a=0, b=0, c=0):                  print(a+b+c) >>> x = map(cal, l1, l2, l3) >>> x <map object at 0x03FB6100> >>> x = list(x) Output: 11 10 9 8 7 Quiz Level 1 Quiz Level 2 Request Me