首页
Java
登录
6mi
u
盘
搜
搜 索
Java
写点类,再写直线类,算两点间的距离
写点类,再写直线类,算两点间的距离
xiaoxiao
2021-02-27
154
import math class Point: def __init__(self,x=0,y=0): self.x=x self.y=y class Line(Point): def getLen(self,p1,p2): r=math.sqrt(((p1.x-p2.x)**2)+(p1.y-p2.y)**2) return r p1=Point(1,1) p2=Point(4,5) l=Line() hh=l.getLen(p1,p2) print(hh)
转载请注明原文地址: https://www.6miu.com/read-14374.html
技术
最新回复
(
0
)