iters.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pwndemo 作者: zh-explorer 项目源码 文件源码
def dotproduct(x, y):
    """dotproduct(x, y) -> int

    Computes the dot product of `x` and `y`.

    Arguments:
      x(iterable):  An iterable.
      x(iterable):  An iterable.

    Returns:
      The dot product of `x` and `y`, i.e.: ``x[0] * y[0] + x[1] * y[1] + ...``.

    Example:
      >>> dotproduct([1, 2, 3], [4, 5, 6])
      ... # 1 * 4 + 2 * 5 + 3 * 6 == 32
      32
    """
    return sum(imap(operator.mul, x, y))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号