牛客网刷题-(9)

简介: 牛客网刷题-(9)

(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)

目录
相关文章
|
7月前
牛客网刷题总结4-22
牛客网刷题总结4-22
36 0
牛客网刷题-(7)
牛客网刷题-(7)
40 1
牛客网刷题-(10)
牛客网刷题-(10)
42 0
|
Python
牛客网刷题-(1)
牛客网刷题-(1)
60 0
牛客网刷题-(4)
牛客网刷题-(4)
44 0
牛客网刷题-(8)
牛客网刷题-(8)
50 0
牛客网刷题-(6)
牛客网刷题-(6)
43 0
牛客网刷题-(3)
牛客网刷题-(3)
40 0
牛客网刷题-(11)
牛客网刷题-(11)
44 0
牛客网刷题-(2)
牛客网刷题-(2)
52 0