Python - Using lambda in map function

Introduction

You can use lambda here:

Demo

counters = [1, 2, 3, 4] 

d=list(map((lambda x: x + 3), counters))     # Function expression 
print( d )

Result

Here, the function adds 3 to each item in the counters list.

Related Topic