added util function for adding lists by value

This commit is contained in:
Greg Wiatroski 2005-03-04 18:25:44 +00:00
parent 2e5a15c145
commit 59fbee7ece

View File

@ -747,6 +747,16 @@ def average(*args):
val += arg
return val / len(args)
def addListsByValue(a, b):
"""
returns a new array containing the sums of the two array arguments
(c[0] = a[0 + b[0], etc.)
"""
c = []
for x, y in zip(a, b):
c.append(x + y)
return c
def boolEqual(a, b):
"""
returns true if a and b are both true or both false.