filter
(
predicate
,
sequence
)
Given a function and a sequence, constructs a sequence only with the elements for which the function is true.
predicate
function (boolean predicate) that given an element returns True iff the element is to be kept
sequence
sequence to filter
list(filter(lambda n: n >= 6, [4, 6, 7, 2, 10]))
[6, 7, 10]
See also filter in the official documentation
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version ede3c94 (Fri, 23 May 2025 14:43:18 GMT)