예제 #1
0
파일: tests.py 프로젝트: cesarfm/pyprimes
def product(values):
    """Return the product of multiplying all the values.

    >>> product([3, 4, 5, 10])
    600
    >>> product([])
    1

    """
    return reduce(operator.mul, values, 1)
예제 #2
0
파일: tests.py 프로젝트: uzumaxy/pyprimes
def product(values):
    """Return the product of multiplying all the values.

    >>> product([3, 4, 5, 10])
    600
    >>> product([])
    1

    """
    return reduce(operator.mul, values, 1)
예제 #3
0
파일: tests.py 프로젝트: uzumaxy/pyprimes
 def test_reduce(self):
     values = [1, 2, 3, 3, 6, 8, 9, 9, 12, 15, 0, 2, 7]
     self.assertEqual(reduce(operator.add, values), sum(values))
예제 #4
0
파일: tests.py 프로젝트: cesarfm/pyprimes
 def test_reduce(self):
     values = [1, 2, 3, 3, 6, 8, 9, 9, 12, 15, 0, 2, 7]
     self.assertEqual(reduce(operator.add, values), sum(values))