Examveda

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)

B. filter(lambda x, y: x<0, l)

C. filter(reduce x<0, l)

D. reduce(x: x<0, l)

Answer: Option A


This Question Belongs to Python Program >> Functions In Python

Join The Discussion

Related Questions on Functions in Python