Home
Python Tutorial
Introduction
Data Type
Statement
Operator
String
Tuple
List
Dictionary
Collections
Function
Class
File
Buildin Function
Buildin Module
Database
Regular Expressions
Thread
Tkinker
wxPython
XML
Network
CGI Web
Windows
Menu
reduce and lambda : reduce « Buildin Function « Python Tutorial
Python Tutorial
Buildin Function
reduce
reduce((lambda x, y: x + y), [1, 2, 3, 4]) reduce((lambda x, y: x * y), [1, 2, 3, 4])
13.40.reduce
13.40.1.
"reduce(func, sequence)" returns a single value by calling the function func on the first two items of the sequence, then on the result and the next item, and so on
13.40.2.
reduce and lambda