Do a map on list : Map : Buildin Function PYTHON examples


PYTHON examples » Buildin Function » Map »

 

Do a map on list


Do a map on list


counters = [1234]

updated = []
for x in counters:
     updated.append(x + 10)              # add 10 to each item

print updated

def inc(x)return x + 10               function to be run

print map(inc, counters)                      # collect results


print map((lambda x: x + 3), counters)        function expression

           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Buildin Function
» Map