Articles → Python → Lambda Expression In Map Function In Python

Lambda Expression In Map Function In Python






Example


#!/usr/bin/python
# -*- coding: utf-8 -*-
mylist = [1, 2, 3, 4, 5]


def MyFunction(var):
    return var * 2


print (list(map(lambda x: x * 2, mylist)))



Output


Picture showing the output of lambda expression in map function



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, May 14, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250