Advertisement
jtentor

DemoQueue3 - DemoQueue3.py

May 18th, 2020
937
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. __author__ = 'Julio Tentor <jtentor@fi.unju.edu.ar>'
  4.  
  5.  
  6. from SpecialQueue import SpecialQueue
  7. import random
  8.  
  9.  
  10. print("Demo Queue - versión genérica - Caso Ejemplo b)")
  11. queue1 = SpecialQueue()
  12.  
  13. number = 0
  14. print("Enqueuing...")
  15. for c in range(10):
  16.     number = random.randrange(11)
  17.     queue1.append(number)
  18.     print(number, end=" ")
  19. print()
  20.  
  21. print("Joining with same queue...")
  22. queue2 = queue1.join(queue1)
  23.  
  24. print("Dequeuing...")
  25. while(len(queue1) > 0):
  26.     print(queue1.popleft(), end=" ")
  27. print()
  28.  
  29. print("Dequeuing joined queue...")
  30. while(len(queue2) > 0):
  31.     print(queue2.popleft(), end=" ")
  32. print()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement