要求
1.已知三角形的三条边,海伦公式S=s*(s-a)(s-b)(s-c)**0.5
2.三角形首先要满足能够成三角形(两边相加大于第三边)
0<c<a+b and a+c>b>0 and b+c>a>0
如下:
a=int(input("请输入三角形的第一条边")) b=int(input("请输入三角形的第二条边")) c=int(input("请输入三角形的第三条边")) def isValid(a,b,c): if 0<c<a+b and a+c>b>0 and b+c>a>0: return True else: return False if isValid (a,b,c): s=(a+b+c)/2 S=(s*(s-a)*(s-b)*(s-c))**0.5 print(f"该三角形的面积{S }")