python报错
a = eval(input())b = eval(input())
c = eval(input())
def isTriangle(a,b,c):
if a+b>c and a+c>b and b+c>a:
return 1
else:
return 0
def TriArea():
p = (a+b+c)/2
area = (p*(p-a)(p-c)(p-b))**0.5
return area
if isTriangle(a,b,c) == 1:
print("{},{}和{}能构成三角形,面积为{}".format(a,b,c,TriArea()))
else:
print("{},{}和{}不能构成三角形!".format(a,b,c))
运行后显示TypeError: 'float' object is not callable是为什么捏? 缺少了乘号*
a = eval(input())
b = eval(input())
c = eval(input())
def isTriangle(a,b,c):
if a+b>c and a+c>b and b+c>a:
return 1
else:
return 0
def TriArea():
p = (a+b+c)/2.0
area = (p*(p-a)*(p-c)*(p-b))**0.5
return area
if isTriangle(a,b,c) == 1:
print("{},{}和{}能构成三角形,面积为{}".format(a,b,c,TriArea()))
else:
print("{},{}和{}不能构成三角形!".format(a,b,c))
不能懒 发表于 2021-6-4 21:16
缺少了乘号*
woc 我是sb
页:
[1]