adplus-dvertising
frame-decoration

Question

What is the output of the code shown below?
l=[n for n in range(5)]
f=lambda x:bool(x%2)
print(f(3), f(1))
for i in range(len(l)):
    if f(l[i]):
        del l[i]
        print(i)

a.

True True
1
2
Error

b.

False False
1
2

c.

True False
1
2
Error

d.

False True
1
2

Answer: (a).True True
1
2
Error

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 below?