悬赏本题的答案,望解答

img


我需要上边第四个问题的解决,超级紧急,超级紧急,望解答,可以提价

img

def dotproduct(vector1,vector2):
    print(sum(q*c for q,c in zip(vector1,vector2)))
v1 =[2,5,9,10]
v2=[7,15,8,4]
dotproduct(v1,v2)

第四题的

img


class Point():  #创建一个点类
    def __init__(self, x=0, y=0): #初始化点的坐标(x, y)
        self.x = x
        self.y = y
        
    def getX(self): #获取点的X轴坐标
        return self.x
   
    def getY(self): # 获取点的Y轴坐标
        return self.y
p1=Point(1,1)
p2=Point(2,2)
p3=Point(3,3)
print(((p1.getY()-p2.getY())**2+(p1.getX()-p2.getX())**2)**0.5)
print(((p3.getY()-p2.getY())**2+(p3.getX()-p2.getX())**2)**0.5)
print(((p1.getY()-p3.getY())**2+(p1.getX()-p3.getX())**2)**0.5)
 
def dotproduct(vector1:list,vector2:list):
    s=0
    for i in range(len(vector1)):
        s+=vector1[i]*vector2[i]
    return s

v1=[2,5,9,10]
v2=[7,15,8,4]
print(dotproduct(v1,v2))
class Point():
    def __init__(self,x=0,y=0):
        self.x = x
        self.y = y
    def coord(self):
        return self.x, self.y
    def change_coord(self,x,y):
        self.x=x
        self.y=y
    def line(self,other):
        temp=(self.y-other.y)**2+(self.x-other.x)**2
        return temp**0.5

a=Point()
b=Point(3,0)
c=Point(0,4)
ab=a.line(b)
ac=a.line(c)
bc=b.line(c)
print(ab, ac, bc)