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 2123d16 (Mon, 30 Jun 2025 09:03:43 GMT)