【发布时间】:2015-03-01 03:01:06
【问题描述】:
我一直在研究一个斜率计算器,它还可以找到 x 和 y 截距......我如何在 Python 中做到这一点?谢谢! 这是我当前的代码:
def getSlope(x1, y1, x2, y2):
slope = (y2-y1)/(x2-x1)
return slope
def getYInt(x1, y1, x2, y2):
s = getSlope(x1, y1, x2, y2)
x = 0
y = s*0 + yi
【问题讨论】:
-
记忆中应该是
return s * -x1 + y1
标签: python calculator