Advertisement
jtentor

DemoQueue4 - DemoQueue4.py

May 18th, 2020
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  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 módulo deque - 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
Add Comment
Please, Sign In to add comment
Advertisement