Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. # 3era Evaluacion IT 2015
  2. # T3-4 Bomberos para incendios forestales
  3.  
  4. # Menú:
  5. # 1. Registrar bombero
  6. # 2. Asignar grupos
  7. # 3. Mostrar nombres de un grupo
  8. # 4. Guardar datos
  9. # 5. Leer datos
  10. # 6. Salir
  11. import time
  12. presentados = []
  13. xx = -5
  14. while not xx== 6:
  15. z = "Menu: \n 1. Registrar bombero \n 2. Asignar grupos \n 3. Mostrar nombres de un grupo \n 4. Guardar datos \n 5. Leer datos \n 6. Salir"
  16. print(z)
  17. xx = int(input("Valor: "))
  18. if(xx == 1):
  19. print("")
  20. print("***Registro de bombero(s)***")
  21. n = int(input("Cuantos bomberos quiere ingresar: "))
  22. while not n>=0:
  23. n = int(input("Cuantos bmberos quiere ingresar: "))
  24. i = 1
  25. while i<n+1:
  26. id = input("Cédula: ")
  27. # while not len(id)==10: #Validacion de cedula
  28. # print("Recuerda que la cedula tiene 10 dígitos")
  29. # id = input("Cédula: ")
  30. nom = input("Nombre: ")
  31. nbomb = int(input("# Bombero: "))
  32. prov= int(input("Provincia: "))
  33. # while not prov>=0 and prov<=24: #Validacion de provincia
  34. # prov = int(input("Provincia (0-24): "))
  35. presentados.append({"cedula":id,"nombre":nom,"nbombero":nbomb,"provincia":prov})
  36. if i==n-1:
  37. if n==1:
  38. "El bombero ha sido añadido satisfactoriamente"
  39. if n>1:
  40. "Todos los bomberos han sido añadidos"
  41. i = i + 1
  42. if (xx == 2):
  43. print("***Asignando grupos***")
  44. if (xx == 3):
  45. print("***Nombres de los bomberos***")
  46. i = 0
  47. while (i<len(presentados)):
  48. print(presentados[i]["nombre"])
  49. i = i + 1
  50. i = 1
  51. while i<6:
  52. print("")
  53. i = i +1
  54. if (xx == 4):
  55. narchivo = "misdatos.txt"
  56. archivo = open(narchivo,"w")
  57. while (i<len(presentados)):
  58. archivo.write(presentados[i]["nombre"])
  59. i = i + 1
  60. archivo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement