Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyQueue
#python 3.6.9 #PyQueue: Python Queue example #this code is created by Rezaul Hoque on May 09,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; import queue #FIFO Queue a=queue.Queue(maxsize=60) #LIFO Queue b=queue.LifoQueue(maxsize=60) y=queue. LifoQueue(maxsize=10) #Priority Queue : order of the input is not important value of the input matters;note that lower values get printed first(the word "Demo" is the example) c=queue.PriorityQueue(maxsize=4) s=queue.Queue() s.put('P') s.put('y') s.put('t') s.put('h') s.put('o') s.put('n') s.put(' ') s.put('Q') s.put('u') s.put('e') s.put('u') s.put('e') s.put(' ') c.put('e') c.put('o') c.put('D') c.put('m') y.put(2) y.put(2) y.put(0) y.put(2) y.put(',') y.put(9) y.put(' ') y.put('y') y.put('a') y.put('M') for k in range(0,2): a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') a.put('<') for k in range(0,2): b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') b.put('>') for k in range (0,2): if k%2==0: print(a.get()*30,end='\n') else: print (b.get()*30,end='\n') print ('\n') while not s.empty(): print(s.get(),end='') for k in range(c.qsize()): print(c.get(k),end='') print ('\n') while not y.empty(): print(y.get(),end='') print('\n') for k in range (0,2): if k%2==0: print(a.get()*30,end='\n') else: print (b.get()*30,end='\n')
run
|
edit
|
history
|
help
0
Ej2_PYTHON_203700377.
Lesson#6
15
Guessing game
E
Venture
I_Love_India
Distance between latititude and longitude
Filtering texts within brackets
Pierwiastkowanie