Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- def continuar():
- print()
- input('Presione una tecla para continuar ...')
- os.system('cls')
- def menu():
- print('1) Agregar Empleado')
- print('2) Mostrar empleados ')
- print('3) Cabiar Departamento')
- print('4) ordenar de forma Decendente')
- print('5) Mostrar')
- print('6) Salir')
- eleccion = int(input('Elija una Opción: '))
- while not((eleccion >= 1) and (eleccion <= 6)):
- eleccion = int(input('Elija una Opción: '))
- os.system('cls')
- return eleccion
- def leerNombre():
- nombre = input('Nombre: ')
- while not (nombre!=""):
- nombre = input('Nombre: ')
- return nombre
- def leerDepart():
- dep = int(input('Departamento (1/2/3): '))
- while not((dep==1) or (dep==2) or (dep==3)):
- dep = int(input('Departamento (1/2/3): '))
- return dep
- def leerSalario():
- precio = float(input('Salario: '))
- while not(precio > 0):
- precio = float(input('Salario: '))
- return precio
- def leerEmail(empleado):
- em = str(input("Email: "))
- for (i,item) in enumerate(empleado):
- while not ((item[2]!=em)and("@" in em)and(em[0]!="@")):
- print("Ya Existeo o no valido")
- em = str(input("Email: "))
- return em
- def leerIdent(empleado):
- iden=int(input("Ingrese Id: "))
- for (i,item) in enumerate(empleado):
- while (item[0]==iden):
- print("Ya Existe")
- iden=int(input("Ingrese Id: "))
- return iden
- def leerLista(empleado):
- empleado=[
- [100, "Steven King", "king@gmail.com", "Gerencia", 24000],
- [101, "Neena Kochhar", "neenaKochhar@gmail.com", "Ventas", 17000],
- [102, "Lex De Haan", "lexDeHaan@gmail.com", "Compras", 16000],
- [103, "Alexander Hunold", "alexanderHunold@gmail.com", "Compras", 9000],
- [104, "David Austin", "davidAustin@gmail.com", "Compras", 4800],
- [105, "Valli Pataballa", "valliPataballa@gmail.com", "Ventas", 4200],
- [106, "Nancy Greenberg", "nancyGreenberg@gmail.com", "Ventas", 5500],
- [107, "Daniel Faviet", "danielFaviet@gmail.com", "Ventas", 3000],
- [108, "John Chen", "johnChen@gmail.com", "Compras", 8200],
- [109, "Ismael Sciarra", "ismaelSciarra@gmail.com", "Compras", 7700],
- [110, "Alexander Khoo", "alexanderKhoo@gmail.com", "Comrpas", 3100]]
- respuesta = "s"
- while respuesta != "n":
- iden=leerIdent(empleado)
- nombre=leerNombre()
- dep=leerDepart()
- if dep==1:
- departamento="Gerencia"
- elif dep==2:
- departamento="Ventas"
- else:
- departamento="Compras"
- email=leerEmail(empleado)
- salario=leerSalario()
- empleado.append([iden,nombre,email,departamento,salario])
- respuesta = input("DESEA AGRECAR s/n: ")
- return empleado
- def modificarDep(empleado):
- iden=int(input("Ingrese Id: "))
- depa=input("Nuevo Departamento Ventas/Gerencia/Compras: ")
- for (i,item) in enumerate(empleado):
- if (item[0]==iden):
- item[3]=depa
- print("Modificado")
- break
- else:
- print("No existe")
- def bubbleSort(empleado):
- n = len(empleado)
- for i in range(n):
- for j in range(0, n-1):
- if empleado[j][1] < empleado[j+1][1]:
- empleado[j][1], empleado[j+1][1] = empleado[j+1][1], empleado[j][1]
- print(empleado)
- def mostrarEm(empleado):
- print('Empleados Desde el Id: ')
- em1 = int(input("Ingrese Id: "))
- print('Empleados hasta el Id: ')
- em2 = int(input("Ingrese Id: "))
- for cod, datos in enumerate(empleado):
- if ((datos[0] >= em1) and (datos[0] <= em2)):
- print(datos)
- def mostrar(empleado):
- for pos, elem in enumerate(empleado):
- print(elem)
- def salir():
- print('FIN DEL PROGRAMA....')
- #principal
- empleado=()
- opcion = 0
- os.system('cls')
- while (opcion != 7):
- opcion = menu()
- if opcion == 1:
- empleado=leerLista(empleado)
- elif opcion == 2:
- mostrarEm(empleado)
- elif opcion == 3:
- modificarDep(empleado)
- elif opcion == 4:
- bubbleSort(empleado)
- elif opcion == 5:
- mostrar(empleado)
- elif (opcion == 6):
- salir()
- continuar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement