#2
william20112018-02-03 00:51
|
最近做作业,目的就是写一个方程 ,给了 (x1,y1) (x2,y2)最后产生一个直线的class,y=ax+b
class的第一项是a,第二项b
然后写一个方程
def a(x1,y1,x2,y2):
问题是这样的让我很头疼因为教科书上也没写
最后的结果需要这么写,Line.points_to_line(-7,6,9,6) 产生Line(0,6))
我不知道Line后面(Line.)是需要写个什么样的东西才能 return出一个Line
Class Line:
def __init__(self,slope,intercept):
self.slope = slope
self.intercept = intercept