adplus-dvertising
frame-decoration

Question

What is the output of the code shown?
l=[1, -2, -3, 4, 5]
def f1(x):
    return x<2
m1=filter(f1, l)
print(list(m1))

a.

[1, 4, 5 ]

b.

Error

c.

[-2, -3]

d.

[1, -2, -3]

Answer: (d).[1, -2, -3]

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the code shown?