有人知道如何计算三角形的 Area/Perimeter/Height 吗?

Anyone Know How to Calculate the Area/Perimeter/Height of a Triangle?

我是 Python 的新手,我在某个地方遇到过这个问题:

"Produce a programme that can calculate the perimeter of the triangle, the area of the triangle and the height of the triangle from the length of the three sides of a triangle. If the three lengths of the sides of the triangle do not define a valid triangle, a message should be displayed stating that this is not a valid calculation and the process should be terminated."

有人知道怎么解决吗?这可能很简单,但我是新手所以是的

这是我目前得到的:

a = float(input('Please Enter the First side of a Triangle: '))

b = float(input('Please Enter the Second side of a Triangle: '))

c = float(input('Please Enter the Third side of a Triangle: '))

if  a + b >= c and b + c >= a and c + a >= b:

# calculate area and height here


Perimeter = a + b + c

s = (a + b + c) / 2

Area = (s*(s-a)*(s-b)*(s-c)) ** 0.5

print("\n The Perimeter of Triangle = %.2f" %Perimeter);

print(" The Area of a Traiangle is %0.2f" %Area)     
else:
print('Not a valid triangle')

我还要计算身高。现在其他一切似乎都在工作:D

In mathematics, the triangle inequality states that for any triangle, the sum of the lengths of any two sides must be greater than or equal to the length of the remaining side.

a, b, c = 1, 1, 1 # sides of a triangle
if a + b >= c and b + c >= a and c + a >= b:
    # calculate area and height here
else:
    print('Not a valid triangle')