-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue_peak.py
More file actions
67 lines (56 loc) · 1.77 KB
/
queue_peak.py
File metadata and controls
67 lines (56 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os
import queue_implementaion
import queue_creating
class style():
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
MAGENTA = '\033[35m'
CYAN = '\033[36m'
WHITE = '\033[37m'
UNDERLINE = '\033[4m'
RESET = '\033[0m'
def queue_top_check():
queue = queue_creating.queue_return()
if queue == []:
print(style.RED + "Your queue is empty")
input("Enter any key to close: ")
queue_top()
else:
print(style.RED + "Your queue peak element is " + str(queue[0]) + " .")
input("Enter any key to close: ")
queue_top()
def queue_top_review():
print(style.WHITE + """
def queue_top_check():
queue = queue_creating.queue_return()
if queue == []:
print(style.RED + "Your queue is empty")
input("Enter any key to close: ")
queue_top()
else:
print(style.RED + "Your queue top element is " + str(queue[-1]) +" .")
input("Enter any key to close: ")
queue_top()
""")
input(style.RED + "Enter any key to close: ")
queue_top()
def queue_top():
print(style.YELLOW + """
[+] The "peak" element of the queue is the element that was first enqued and will be the first to be dequed.
1: Check the top element in your created queue
2: code review
3: back
""")
selection = input("Enter your selection: ")
if selection == '1':
queue_top_check()
elif selection == '2':
queue_top_review()
elif selection == '3':
queue_implementaion.queue_implementaion()
else:
print(style.RED + "[+] invalid input try again!")
queue_top()