Advertisement
diegokr

Ejercicio 3

Nov 13th, 2019
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.17 KB | None | 0 0
  1. # *******************************************
  2. # Introducción a la programación
  3. # Segundo Parcial Práctico - Ejercicio 3
  4. # Fecha: 5/11/19
  5. # Autor: Lic. Diego Krauthamer
  6. # Descripción: Sistema de gestión académico
  7. # *******************************************
  8.  
  9. #Declaración de constantes
  10.  
  11. #Declaración de variables
  12. opcion=-1
  13. continuar="S"
  14. nombre=""
  15. carrera=""
  16. nota=0
  17. canttur=0
  18. cantpef=0
  19. cantci=0
  20. sumatur=0
  21. sumapef=0
  22. sumaci=0
  23.  
  24. #Cuerpo principal del programa
  25. while opcion !=3:
  26.  
  27.     #Inicializacion de variables
  28.     opcion=-1
  29.     continuar="S"
  30.  
  31.     #Dibujo el menu principal de opciones
  32.     print("M E N U   P R I N C I P A L")
  33.     print("1. Alta de alumnos")
  34.     print("2. Reportes")    
  35.     print("3. Salir")
  36.  
  37.     #Ingreso de datos y validacion
  38.     while opcion <1 or opcion >3:
  39.         print("Seleccione una opción:")
  40.         opcion=int(input())
  41.  
  42.         #Mensaje de errores
  43.         if opcion <1 or opcion >3:
  44.             print("ERROR- Por favor seleccione una opción valida(1-3):")
  45.  
  46.     #Determino la oprecion elegida
  47.     if opcion==1:
  48.        
  49.         while(continuar=="S"):
  50.  
  51.             #Inicializacion de variables
  52.             nombre=""
  53.             carrera=""
  54.             nota=-1
  55.             continuar=""
  56.  
  57.             # ***************************************
  58.             #     I N G R E S O   D E    D A T O S
  59.             # ***************************************
  60.  
  61.             #Ingreso y validacion del nombres
  62.             while nombre =="":
  63.                 print("Ingrese el nombre:")
  64.                 nombre=input()
  65.            
  66.                 #Mensaje de error
  67.                 if nombre =="":
  68.                     print("ERROR - Ingrese un nombre")
  69.  
  70.             #Ingreso y validacion de la carrera
  71.             while carrera =="" and carrera!="t" and carrera !="p" and carrera!="c":
  72.                 print("Ingrese carrera:")
  73.                 print("T-Turismo")
  74.                 print("P-PEF")
  75.                 print("C-Construcciones inteligentes")
  76.                 carrera=input()
  77.            
  78.                 #Mensaje de error
  79.                 if carrera =="" and carrera!="t" and carrera !="p" and carrera!="c":
  80.                     print("ERROR - Ingrese una carrera válida")
  81.                      
  82.             #Ingreso de notas
  83.             while nota <1 or nota >10:
  84.                 print("Ingrese nota final de cursada:")
  85.                 nota=int(input())
  86.  
  87.                 #Mensaje de error
  88.                 if nota <1 or nota >10:
  89.                    print("ERROR - Ingrese una nota entre 1 y 10")
  90.  
  91.             # ******************************************
  92.             #       E S T A D I S T I C A S
  93.             # ******************************************
  94.             # Determino la carrera del alumno para contar
  95.             # y calcular la sumatoria por carrera
  96.             #
  97.             # ******************************************
  98.             if carrera=="t":
  99.                 canttur=canttur+1
  100.                 sumatur=sumatur+nota
  101.             elif carrera=="p":
  102.                 cantpef=cantpef+1
  103.                 sumapef=sumapef+nota
  104.             else:
  105.                 cantci=cantci+1
  106.                 sumaci=sumaci+nota
  107.  
  108.             #Pregunto si Desea continuar
  109.             while continuar =="" and continuar!="s" and continuar !="n":
  110.                 print("Desea continuar S/N")
  111.                 continuar=input()
  112.  
  113.                 #Mensaje de error
  114.                 if continuar =="" and continuar!="s" and continuar !="n":
  115.                     print("ERROR - Ingrese S/N")
  116.                
  117.     elif opcion==2:
  118.         # *********************************
  119.         #  R E P O R T E S
  120.         # *********************************
  121.         print("Cantidad de alumnos de Turismo:",canttur)
  122.         print("Cantidad de alumnos de PEF",cantpef)
  123.         print("Cantidad de alumnos de Construcciones",cantci)
  124.         print("Cantidad Total de alumnos:",canttur+cantpef+cantci)
  125.         if canttur!=0:
  126.             print("Promedio de Turismo",sumatur/canttur)
  127.         if cantpef!=0:
  128.             print("Promedio de PEF",sumapef/cantpef)
  129.         if cantci!=0:
  130.             print("Promedio de Construcciones",sumaci/cantci)
  131.         print("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement