reduce
(
function
,
sequence
)
Repetedly call a function with the elements of a sequence from left to right, accumulating the result.
Optionally, an initial value can be used to start the accumulation.
function
A function that combines the accumulated value with an element of the sequence
sequence
A sequence of elements
reduce(lambda acc, s: acc + ' ' + s, ['PyTamaro', 'is', 'cool'])
'PyTamaro is cool'
See also reduce 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 b15482e (Tue, 09 Sep 2025 14:03:12 GMT)