Write lambda function - python

0 votes
How do I write this using lambda function?
May 23 in Python by Tanmay
19 views

1 answer to this question.

0 votes

Lambda equivalent for this section of python code would be the following:

map(lambda x : x*2, [1, 2, 3, 4]) #Output [2,4, 6, 8]
answered May 23 by Umer

Related Questions In Python

0 votes
1 answer

Python: Lambda function in List Comprehensions

The first one create a single lambda ...READ MORE

answered Aug 27, 2018 in Python by Priyaj
• 56,520 points
144 views
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
70 views
0 votes
1 answer

What does ' -> ' mean in Python function definitions?

It's a function annotation. In more detail, Python 2.x ...READ MORE

answered May 22, 2018 in Python by charlie_brown
• 7,720 points
47 views
+1 vote
1 answer

What is the function for Factorial in Python

Easiest way: math.factorial(x) (available in 2.6 and ...READ MORE

answered Aug 21, 2018 in Python by Priyaj
• 56,520 points

edited Aug 21, 2018 by Omkar 114 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 174 views
+4 votes
6 answers
0 votes
1 answer

Difference between a normal def defined function and lambda function in python?

Have a look at this code: # Python ...READ MORE

answered May 20 in Python by Trisha
35 views
0 votes
1 answer

Convert python code into lambda function

This should work: add = lambda x, y ...READ MORE

answered May 23 in Python by Payal
31 views