+ 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?
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)
+ 3
Check the Python course. It will probably have answers.
0
The output will be a list of the numbers in n divide by 2, as integers.
you can also run it like this