[go: up one dir, main page]

0% found this document useful (0 votes)
24 views1 page

Filter

The filter() function is used to filter elements from an iterable by applying a specified function. It returns a filter object that can be converted into other iterable types. The function processes each element, retaining those for which the function returns True and discarding those for which it returns False.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Filter

The filter() function is used to filter elements from an iterable by applying a specified function. It returns a filter object that can be converted into other iterable types. The function processes each element, retaining those for which the function returns True and discarding those for which it returns False.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

=========================================================

1. filter()
=========================================================
=>filter() is used for "Filtering out some elements from list of elements by
applying to function".
=>Syntax:- varname=filter(FunctionName, Iterable_object)
---------------------
Explanation:
---------------------
=>here 'varname' is an object of type <class,'filter'> and we can convert into any
iteratable object by using type
casting functions.
=>"FunctionName" represents either Normal function or anonymous functions.
=>"Iterable_object" represents Sequence, List, set and dict types.
=>The execution process of filter() is that " Each Value of Iterable object sends
to Function Name. If the function return True then the element will be filtered. if
the Function returns False then that element will be neglected/not filtered ". This
process will be continued until all elements of Iterable object completed".
-----------------------------------------------------------------------------------
---------------------------------------------------------------------------------

You might also like