Mock_ApiClient_anyHash
我有这个写法,但每次运行它都会返回0.0
的值答案 0 :(得分:1)
我建议使用raw_input
而不是input
。
如果使用python 2.x,如果两个参数都是/
,则int
为分层,因此要保存,请确保输入转换为{{1} }。
请注意float
和+
的操作顺序:如果/
之前需要评估+
,则需要将其/
放入()
您需要打印变量slope
。
所以:
x1 = float(raw_input('x1')) # point 1 and point 2 (conversion to float)
x2 = float(raw_input('x2'))
y1 = float(raw_input('y1'))
y2 = float(raw_input('y2'))
slope = (y2-y1) / (x2-x1) # point 3: () are needed here
print("The slope is {0}".format(slope)) # point 4