Vidyalelo
Python · Q126

Functions in Python

Programming · Python · question 126

Q126

The single line equivalent of the following Python code? l=[1, 2, 3, 4, 5] def f1(x): return x<0 m1=filter(f1, l) print(list(m1))

A.
filter(lambda x:x<0, l)
Answer
B.
filter(lambda x, y: x<0, l)
C.
filter(reduce x<0, l)
D.
reduce(x: x<0, l)

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board