Guest User

Untitled

a guest
Nov 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. # Hacer funciones para calcular el promedio considerando:
  2. # tarea academica 30%
  3. # control de lectura 70%
  4.  
  5. def promedio(lista):
  6. return float(sum(lista)/len(lista))
  7.  
  8. def ponderado(promedio,porcentaje):
  9. return float(promedio*porcentaje/100)
  10.  
  11. def PromedioFinal(ta,cl):
  12. return ta+cl
  13.  
  14. def AgregarLista(lista,valor):
  15. lista.append(valor)
  16.  
  17. def ImprimirLista(lista):
  18. for valor in lista:
  19. print valor
  20.  
  21. ta = []
  22. cl = []
  23. respuesta = 's'
  24.  
  25. while respuesta=='s':
  26. print "Elegir una opcion"
  27. print "1. Ingresar notas de tarea academica"
  28. print "2. Ingresar notas de control de lectura"
  29. print "3. Promedio de Tarea Academica"
  30. print "4. Promedio de Control de Lectura"
  31. print "5. Promedio Final"
  32. print "6. Salir"
  33. opcion = int(raw_input())
  34.  
  35. if opcion == 1:
  36. AgregarLista(ta,int(raw_input("Ingrese una nota para TA: ")))
  37. elif opcion == 2:
  38. AgregarLista(cl,int(raw_input("Ingrese una nota para CL: ")))
  39. elif opcion == 3:
  40. if len(ta) == 0:
  41. print "No se puede calcular, no existen notas"
  42. else:
  43. print promedio(ta)
  44. elif opcion == 4:
  45. if len(cl) == 0:
  46. print "No se puede calcular, no existen notas"
  47. else:
  48. print promedio(cl)
  49. elif opcion == 5:
  50. if len(ta)==0 or len(cl) == 0:
  51. print "No se puede calcular, no existen notas"
  52. else:
  53. print PromedioFinal(ponderado(promedio(ta),30),ponderado(promedio(cl),70))
  54. elif opcion == 6:
  55. quit()
  56. else:
  57. print "Elija otra opcion"
Add Comment
Please, Sign In to add comment