I ran Python beginner function, but nothing came out.

Asked 2 years ago, Updated 2 years ago, 16 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


© 2024 OneMinuteCode. All rights reserved.