Why is the list I print not filtered?


#1

Question

Why is the list I print not filtered?

Answer

If you’ve written your filter() code on a line by itself, it will not be printed to the screen. The only way something will be printed is to use the print function.
It’s perfectly fine to print the results of a function by writing that function, like filter() after the word print, like this:
print filter(lambda, list_name)


FAQ: Learn Python - Advanced Topics in Python - Try It!