代码出现非零返回如何解决

import math
def accont(a,b,c):
a=int(a)
b=int(b)
c=int(c)
P=int((a+b+c)/2)
S=int(math.sqrt(P*(P-a)(P-b)(P-c)))
return S
A=int(input())
B=int(input())
C=int(input())
LIS=[A,B,C]
LIS.sort()
if LIS[0]<LIS[1]+LIS[2] and LIS[0]-LIS[1]<LIS[2]:
RESULT=accont(A,B,C)
print("%.2f"%(RESULT))
else:
print("数据错误")
pass

你在这里出现了语法错误

img


修改意见,参照下方建议代码修改

import math


def accont(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    P = int((a + b + c) / 2)
    S = int(math.sqrt(P * (P - a)*(P - b)*(P - c)))
    return S


A = int(input())
B = int(input())
C = int(input())
LIS = [A, B, C]
LIS.sort()
if LIS[0] < LIS[1] + LIS[2] and LIS[0] - LIS[1] < LIS[2]:
    RESULT = accont(A, B, C)
    print("%.2f" % (RESULT))
else:
    print("数据错误")

有帮助请采纳,有问题继续交流,你的采纳是对我回答的最大的肯定和动力

LIS[0]<LIS[1]+LIS[2] 和这个 LIS[0]-LIS[1]<LIS[2]: 这两个条件判断有啥区别 是要判断能组成三角形?