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
Post a Comment