这个python题实在是不会,麻烦大家帮忙看看!实在是学不太懂。
a = float(input(""))
b = float(input(""))
c = float(input(""))
if a <= 0 or b <= 0 or c <= 0:
print("三条边不能有负数")
elif a + b > c and b + c > a and a + c > b:
print("三角形的边长,a={0}, b={1}, c={2}".format(a, b, c))
else:
print("a, b, c不能构成三角形")
简单呀 我写给你:
#输入三个整数的边长
a = int(input())
b = int(input())
c = int(input())
if a < 0 or b < 0 or c < 0: #输入的边长不能有负数
print("三条边不能为负数")
elif (a + b) > c and (a + c) > b and (b + c) > a: #两边之和大于第三边则为三角形
print("三角形的边长是:a={},b={},c={}".format(a, b, c))
else:
print("不能构成三角形")
运行结果: