Mega Code Archive

 
Categories / Python Tutorial / Buildin Function
 

Reduce(func, sequence) returns a single value by calling the function func on the first two items of the sequence, then o

def add(x,y):  return x+y print reduce(add, range(1, 11))