题解 | 点积计算器

点积计算器

https://www.nowcoder.com/practice/e8b40a6346854c988672510a576ff8b3

import numpy as np

def calculate_dot_product(vec1, vec2):
    """
    Calculate the dot product of two vectors.
    Args:
        vec1 (numpy.ndarray): 1D array representing the first vector.
        vec2 (numpy.ndarray): 1D array representing the second vector.
    Returns:
        float: Dot product of the two vectors.
    """
    dot = np.dot(vec1,vec2)
    return dot

if __name__ == "__main__":
    vec1 = np.array(eval(input()))
    vec2 = np.array(eval(input()))
    print(calculate_dot_product(vec1, vec2))

全部评论

相关推荐

06-12 16:23
已编辑
小米_软件开发(准入职员工)
点赞 评论 收藏
分享
秋招不是要开始了吗,我都打算润了,看大家还在找不敢润了
一条从:因为不是人人都像佬一样有实习像我们这种二本仔秋招没有实习也是白忙活
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务