参考8.1.4的类Point的代码

参考8.1.4的类Point的代码

 

 

import random
a = random.randrange(1,10)
b = random.randrange(1,10)
class PointLenth:
    def __init__(self,x,y,x1,y1):
        self.x=x
        self.x1=x1
        self.y=y
        self.y1=y1
    def lenth(self):
        dx=(self.x)-(self.x1)
        dy=(self.y)-(self.y1)
        distance=(dx**2+dy**2)**0.5
        print(distance)

p1=PointLenth(a,22,b,21)
print(p1.lenth())
print(' 运行完毕!')

 

上一篇:Xamarin Forms Prism Navigation from TabbedPage behaves as PushModelAsync or the navigation bar disappears


下一篇:Android开发 关于navigation destination xxx is unknown to this NavController 报错的复现分析与解决