Reduce() Function

Reduce() Function

  • The  reduce() function reduces a sequence of elements to single value by processing the elements according to a function supplied.
  • Reduce() function present in functools module and hence we should write import statement.

Syntax:

  • reduce(function, sequence)

Note:-

  • In Python every thing is treated as object.
  • Even functions also internally treated as objects only


Comments