abydos.util module

abydos.util.

The util module defines various utility functions for other modules within Abydos, including:

  • prod – computes the product of a collection of numbers (akin to sum)
abydos.util.prod(nums)[source]

Return the product of nums.

The product is Π(nums).

Cf. https://en.wikipedia.org/wiki/Product_(mathematics)

Parameters:nums – a collection (list, tuple, set, etc.) of numbers
Returns:the product of a nums
Return type:numeric
>>> prod([1,1,1,1])
1
>>> prod((2,4,8))
64
>>> prod({1,2,3,4})
24
>>> prod(2**i for i in range(5))
1024