ch08
`import random
num1=random.randrange(1,10)
num2=random.randrange(1,10)
print(num1)
print(num2)
class PointLenth:
def init(self,x1,y1,x2,y2):
self.x1=x1
self.x2=x2
self.y1=y1
self.y2=y2
def lenth(self):
dx=(self.x1)-(self.x2)
dy=(self.y1)-(self.y2)
distance=(dx2+dy2)**0.5
print(distance)
p1=PointLenth(num1,26,num2,22)
print(p1.lenth())`
posted on 2021-12-03 17:30 20211426赵炫宇 阅读(35) 评论(0) 编辑 收藏 举报