题解 | 两点间距离

两点间距离

https://www.nowcoder.com/practice/94712d6f654143379f8ea5847d9d6225

import math
class Point:
    def __init__(self, a=0, b=0):
        self.x = a
        self.y = b

class Solution:
    def calculateDistance(self , point_A: Point, point_B: Point) -> float:
        distance=math.sqrt((point_A.x-point_B.x)**2+(point_A.y-point_B.y)**2)
        return distance

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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