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))
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)
B. filter(lambda x, y: x<0, l)
C. filter(reduce x<0, l)
D. reduce(x: x<0, l)
Answer: Option A

Join The Discussion