adplus-dvertising
frame-decoration

Question

What is the output of the following piece of code?
a = [5,5,6,7,7,7]
b = set(a)
def test(lst):
    if lst in b:
        return 1
    else:
        return 0
for i in  filter(test, a):
    print(i,end=" ")

a.

5 5 6

b.

5 6 7

c.

5 5 6 7 7 7

d.

5 6 7 7 7

Posted under Tuples and Sets Python

Answer: (c).5 5 6 7 7 7

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 following piece of code?