jtentor

DemoQueue1 - DemoQueue1.py

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