0
Any condition for filter?
Shall we use any condition to filter out values from the list?
2 Answers
+ 1
Yes, but know that whichever condition you use must at least be true for at least one of the items in an iterable. Check out this code https://code.sololearn.com/ciOl7W4tds18 and look at the last segment, you can use it to check if any of the items matches your filter.
0
Yes Sure, using filter without condition is meaningless, because it will iterate on all list items like map does.
check this code: https://code.sololearn.com/cNmhCfMXggAP/#py