python求助
查看原帖
python求助
801502
SISULeo楼主2022/11/13 21:55
a, b, c = map(int, input().split())
trilist = [a, b, c]  # 数据列表
trilist.sort()  # 排序
resultlist = []  # 输出列表
if trilist[0] + trilist[1] > trilist[2] and trilist[0] + trilist[2] > trilist[1] and trilist[1] + trilist[2] > trilist[
    0]:
    if pow(trilist[0], 2) + pow(trilist[1], 2) == pow(trilist[2], 2):
        resultlist.append("Right triangle")
    elif pow(trilist[0], 2) + pow(trilist[1], 2) > pow(trilist[2], 2):
        resultlist.append("Acute triangle")
    elif pow(trilist[0], 2) + pow(trilist[1], 2) < pow(trilist[2], 2):
        resultlist.append("Obtuse triangle")
    elif trilist[0] == trilist[1] or trilist[1] == trilist[2]:
        resultlist.append("Isosceles triangle")
    elif trilist[0] == trilist[1] == trilist[2]:
        resultlist.append("Equilateral triangle")
    for i in resultlist:
        print(i, "\n")

elif trilist[0] + trilist[1] < trilist[2] or trilist[0] + trilist[2] < trilist[1] or trilist[1] + trilist[2] < trilist[
    0]:
    print("Not triangle")


2022/11/13 21:55
加载中...