Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 3era Evaluacion IT 2015
- # T3-4 Bomberos para incendios forestales
- # Menú:
- # 1. Registrar bombero
- # 2. Asignar grupos
- # 3. Mostrar nombres de un grupo
- # 4. Guardar datos
- # 5. Leer datos
- # 6. Salir
- import time
- presentados = []
- xx = -5
- while not xx== 6:
- 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"
- print(z)
- xx = int(input("Valor: "))
- if(xx == 1):
- print("")
- print("***Registro de bombero(s)***")
- n = int(input("Cuantos bomberos quiere ingresar: "))
- while not n>=0:
- n = int(input("Cuantos bmberos quiere ingresar: "))
- i = 1
- while i<n+1:
- id = input("Cédula: ")
- # while not len(id)==10: #Validacion de cedula
- # print("Recuerda que la cedula tiene 10 dígitos")
- # id = input("Cédula: ")
- nom = input("Nombre: ")
- nbomb = int(input("# Bombero: "))
- prov= int(input("Provincia: "))
- # while not prov>=0 and prov<=24: #Validacion de provincia
- # prov = int(input("Provincia (0-24): "))
- presentados.append({"cedula":id,"nombre":nom,"nbombero":nbomb,"provincia":prov})
- if i==n-1:
- if n==1:
- "El bombero ha sido añadido satisfactoriamente"
- if n>1:
- "Todos los bomberos han sido añadidos"
- i = i + 1
- if (xx == 2):
- print("***Asignando grupos***")
- if (xx == 3):
- print("***Nombres de los bomberos***")
- i = 0
- while (i<len(presentados)):
- print(presentados[i]["nombre"])
- i = i + 1
- i = 1
- while i<6:
- print("")
- i = i +1
- if (xx == 4):
- narchivo = "misdatos.txt"
- archivo = open(narchivo,"w")
- while (i<len(presentados)):
- archivo.write(presentados[i]["nombre"])
- i = i + 1
- archivo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement