Python 2.7 循环四边形';s远程程序

Python 2.7 循环四边形';s远程程序,python-2.7,Python 2.7,有人能帮我吗 #Program to find the area and perimeter of any quad #First find length of 2 points using distance formula print "This program is to find the perimeter of a quadrilateral." print "Tell me the points, In order that the first set of points is on

有人能帮我吗

#Program to find the area and perimeter of any quad

#First find length of 2 points using distance formula
print "This program is to find the perimeter of a quadrilateral."
print "Tell me the points, In order that the first set of points is on the top left, the second set of points is on the bottom left, the third set of points is on the bottom right, and the fourth set of points is on the top right"
a = int(raw_input("First x-coordinate point is... "))
b = int(raw_input("First y-coordinate point is... "))
c = int(raw_input("Second x-cordinate point is..."))
d = int(raw_input("Second y-coordinate point is..."))
e = int(raw_input("Third x-coordinate point is..."))
f = int(raw_input("Third y-coordinate point is..."))
g = int(raw_input("Fourth x-coordinate point is..."))
h = int(raw_input("Fourth y-coordiante point is..."))
i = ((c-a)**(2) + (d-b)**(2))**(0.5)
j = ((g-e)**(2) + (h-f)**(2))**(0.5)
k = ((e-c)**(2) + (f-d)**(2))**(0.5)
l = ((g-a)**(2) + (h-b)**(2))**(0.5)

#Then find the perimeter of a quad adding the four points.
m = i + j + k + l
print m

#Finally, find the area of the quad using brahmagupta's formula.
n = m / 2
o = (n-i)(n-j)(n-k)(n-l)**0.5
print o

在倒数第二行,它给出了一个语法错误,指出“float对象不可调用”

您缺少这一行中的乘法运算符:

o = (n-i)(n-j)(n-k)(n-l)**0.5
应该是哪一个

o = (n-i)*(n-j)*(n-k)*(n-l)**0.5
但是,最后一项仅取括号中最后一项的平方根。对于Brahmagupta的公式,您需要整个表达式的平方根,在这种情况下,您需要:

o = ((n-i)*(n-j)*(n-k)*(n-l))**0.5

我问你答案的意思是,你可以给我一些如何做的想法。对不起,没有具体说明。这不是我的硬件,只是我想出的一个主意,并决定在春假期间完成。代表我再次表示歉意。大多数编程语言不进行隐式乘法(Python也不例外),并且需要在要乘法的术语之间使用
*
。因此:
o=(n-i)*(n-j)*(n-k)*(n-l)**0.5
。假设
**
是幂运算符,它取一项的平方根,而不是4项的乘积。因此:
o=((n-i)*(n-j)*(n-k)*(n-l))**0.5