python - Writing the filter() function using for/while loops -


i trying understand how filter() function works , know how write:

test = filter(lambda x: x == y, lst)  

using for or while loops.

filter() pretty making new list loop , conditional. in example, identical to:

l = [] in lst:     if == y:         l.append(i) 

or list comprehension:

[i in lst if == y] 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -