handy utility is compose(this is function that takes sequence of functions and returns function that represents the application of each of these argument functions to data argumentdef compose(*funcs)"""return new function compose( , )( = ( ( )))""def inner(datafuncs=funcs)result data for in reversed(funcs)result (resultreturn result return inner times lambda xx* minus lambda xx- mod lambda xx% compose(mod times minus all( ( )==(( - )* )% for in range( )true for these one-line math operations (times minus etc )we could have simply written the underlying math expression at least as easilybut if the composite calculations each involved branchingflow controlcomplex logicetc this would not be true the built-in functions all(and any(are useful for asking whether predicate holds of elements of an iterable but it is also nice to be able to ask whether any/all of collection of predicates hold for particular data item in composable way we might implement these asall_pred lambda item*testsall( (itemfor in testsany_pred lambda item*testsany( (itemfor in teststo show the uselet us make few predicatesis_lt partial(operator ge less than is_gt partial(operator le greater than from nums import is_prime implemented elsewhere all_pred( is_lt is_gt is_primetrue predicates (is_lt is_gt is_primeall_pred( *predicatesfalse the library toolz has what might be more general version of this called juxt(that creates function that calls several functions with utility higher-order functions