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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -