(1)三角形类型
a,b,c = map(float,input().split()) #将 所有的数按照从大到小排序,通过比较大小进行顺序反转 if a < b: a, b = b , a if a < c: a, c = c , a if b < c: b, c = c , b if a >= b + c: print("NAO FORMA TRIANGULO") else: t = b**2 + c**2 if a**2 == t: print("TRIANGULO RETANGULO") if a**2 > t: print("TRIANGULO OBTUSANGULO") if a**2 < t: print("TRIANGULO ACUTANGULO") if a == b == c: print("TRIANGULO EQUILATERO") else: if a ==b or b == c: print("TRIANGULO ISOSCELES")
(2)动物名称
#动物 a = input() b = input() c = input() if a == "vertebrado": if b == "ave": if c == "carnivoro": print("aguia") else: print("pomba") else: if c == "onivoro": print("homem") else: print("vaca") if a == "invertebrado": if b == "inseto": if c == "hematofago": print("pulga") else: print("lagarta") else: if c == "hematofago": print("sanguessuga") else: print("minhoca")
(3)平均数
N1, N2, N3, N4 = map(float, input().split()) x = (2 * N1 + 3 * N2 + 4 * N3 + N4) / (2 + 3 + 4 + 1) print("Media: %.1f" % x) if x >= 7.0: print("Aluno aprovado.") elif x < 5.0: print("Aluno reprovado.") elif 5.0 < x < 7.0: print("Aluno em exame.") y = float(input()) print("Nota do exame: %.1f" % y) z = (x + y) / 2 if z >= 5.0: print("Aluno aprovado.") else: print("Aluno reprovado.") print("Media final: %.1f" % z)