|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
home work
import math as m
import random as r
class Point:
def __init__(self):
self.x = r.randint(0, 100)
self.y = r.randint(0, 100)
print('该点的x坐标为:%d\n该点的y坐标为:%d' % (self.x, self.y))
def self_x(self):
return self.x
def self_y(self):
return self.y
class Line:
def __init__(self, PointA, PointB):
# PointA = Point()
# PointB = Point()
self.line_x = PointA.self_x() - PointB.self_x()
self.line_y = PointA.self_y() - PointB.self_y()
self.length = m.sqrt(self.line_x *self.line_x + self.line_y*self.line_y)
def length(self):
return self.length
|
|