dimkaxrsa

Prioridades

Mar 8th, 2016
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. try:
  2.     import Queue as prioridad
  3. except ImportError:
  4.     import queue as prioridad
  5.  
  6. def orden():
  7.     Prioridades = prioridad.PriorityQueue()
  8.     Prioridades.put((1, "Reloj"))
  9.     Prioridades.put((2, "Teclado"))
  10.     Prioridades.put((3, "Mouse"))
  11.     Prioridades.put((4, "Impresora"))
  12.  
  13.     while not Prioridades.empty():
  14.         print Prioridades.get(),
  15.  
  16. print """
  17. Interrupcion de Hardware
  18. 1. Reloj
  19. 2. Teclado
  20. 3. Mouse
  21. 4. Impresora
  22. """
  23.  
  24. AleatorioUno = input("Prioridad: ")
  25. AleatorioDos = input("Prioridad: ")
  26. AleatorioTres = input("Prioridad: ")
  27. AleatorioCuatro = input("Prioridad: ")
  28. if AleatorioUno >=5:
  29.     print "Usaste un valor invalido en el input 1"
  30. if AleatorioDos >=5:
  31.     print "Usaste un valor invalido en el input 2"
  32. if AleatorioTres >=5:
  33.     print "Usaste un valor invalido en el input 3"
  34. if AleatorioCuatro >=5:
  35.     print "Usaste un valor invalido en el input 4"
  36. elif AleatorioUno or AleatorioDos or AleatorioTres or AleatorioCuatro <=4:
  37.     print orden()
  38. print (("Orden Ingresado: ", AleatorioUno, AleatorioDos, AleatorioTres, AleatorioCuatro))
Add Comment
Please, Sign In to add comment