#Python TQC考題210_三角形判斷
s1 = eval(input())
s2 = eval(input())
s3 = eval(input())
if s1+s2<s3: print(“invaid”)
elif s1+s3<s2:print(“invalid”)
elif s2+s3<s1:print(“invalid”)
else: print(s1+s2+s3)
Spyder執行結果:
第二種寫法:
s1=eval(input())
s2=eval(input())
s3=eval(input())
if s1+s2>s3 and s1+s3>s2 and s2+s3>s1:
print(s1+s2+s3)
else:
print(“invalid”)
執行結果:
近期留言