What is the output of this code? n=[2,8,2,6] k=list (map(lambda x: x//2,n)) print (k) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the output of this code? n=[2,8,2,6] k=list (map(lambda x: x//2,n)) print (k)

what is lamda?

27th Nov 2017, 1:36 PM
Janani Waduge
Janani Waduge - avatar
4 Answers
+ 6
Lambdas are anonymous functions. def func():#code Is a function with the name "func" lambda x:#code is a function with no name, but if you wanna call it func, do this: func=lambda x:#code Then you can call the function func(3) for example. Or do: (lambda x:"code")(3)
27th Nov 2017, 2:32 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Check the Python course. It will probably have answers.
27th Nov 2017, 1:45 PM
cHampsonR
cHampsonR - avatar
27th Nov 2017, 2:01 PM
Amir Galanty
Amir Galanty - avatar
0
The output will be a list of the numbers in n divide by 2, as integers. you can also run it like this
27th Nov 2017, 1:58 PM
Amir Galanty
Amir Galanty - avatar