Advertisement
LightProgrammer000

Media

Mar 20th, 2019
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. def main():
  2.     print("\n {0} MEDIA {0}".format("=-=" * 5, "=-=" * 5))
  3.  
  4.     # Entrada de dados
  5.     nota_1 = float(input(" - Nota 1: "))
  6.     nota_2 = float(input(" - Nota 2: "))
  7.  
  8.     media(nota_1, nota_2)
  9.  
  10.     if 0 < media(nota_1, nota_2) < 5.00:
  11.         print(situacao(media(nota_1, nota_2)))
  12.  
  13.     elif 5.00 <= media(nota_1, nota_2) <= 10:
  14.         print(situacao(media(nota_1, nota_2)))
  15.  
  16.     else:
  17.         print(situacao(media(nota_1, nota_2)))
  18.  
  19. # Funcao: Media
  20. def media(a, b):
  21.     return (a + b) / 2
  22.  
  23. # Funcao: Situacao
  24. def situacao(a):
  25.     if 0 < a < 5.00:
  26.         return "\n - Situacao: Reprovado"
  27.  
  28.     elif 5.00 <= a <= 10:
  29.         return "\n - Situacao: Aprovado"
  30.  
  31.     else:
  32.         return "\n - Situacao: Recuperacao"
  33.  
  34. # Chamada de funcao principal
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement