判断三角形的面积及类型(多重选择)

来源:互联网 发布:网络设置(2g) 编辑:程序博客网 时间:2024/06/01 10:02

代码:

# -*- coding:utf-8 -*-import matha=input("请输入a边长:")b=input("请输入b边长:")c=input("请输入c边长:")if a>b:    t=a;a=b;b=tif a>c:    t=a;a=c;c=tif b>c:    t=b;b=c;c=tif a+b>c and a+c>b and b+c>a:    print "可以组成三角形"if a==b and a==c:    print "等边三角形"elif a == b or a == c or b==c:    print "等腰三角形"elif a**2+b**2==c**2:    print "直角三角形"else:    print "普通三角形"

运行结果:


0 0