Advertisement
jtentor

DemoQueue2 - DemoQueue2.py

May 18th, 2020
953
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 _collections import deque
  7. import random
  8.  
  9.  
  10. print("Demo Queue - versión módulo deque")
  11. queue1 = deque()
  12. queue2 = deque()
  13.  
  14. number = 0
  15. character = 'a'
  16. print("Enqueuing...")
  17. for c in range(10):
  18.     number = random.randrange(-5000, 5001)
  19.     queue1.append(number)
  20.     character = chr(random.randrange(65, 90))
  21.     queue2.append(character)
  22.     print(number, character, end=" ")
  23. print()
  24.  
  25. print("Dequeuing...")
  26. while(len(queue1) > 0):
  27.     print(queue1.popleft(), queue2.popleft(), end=" ")
  28. print()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement