I ran Python beginner function, but nothing came out.

Asked 6 days ago, Updated 6 days ago, 1 views

def compact(lst):
    return list(filter(None, lst))
compact ([1,2,3,4,0,"",False,None])

I'm done, but nothing's coming out.

python

2022-09-20 15:40

1 Answers

Do you want this??

def compact(lst):
    return list(filter(None, lst))
print(compact ([1,2,3,4,0,"",False,None]))


2022-09-20 15:40

If you have any answers or tips


© 2022 pinfo. All rights reserved.