-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueque.py
More file actions
49 lines (47 loc) · 1.67 KB
/
Queque.py
File metadata and controls
49 lines (47 loc) · 1.67 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
import Reader as r
import Parser as p
#Queque method
def Cola():
cola = []
choice = 0
Restr = ""
ToQueque = ""
while True:
if (Restr == ""):
Restr = p.ParseList(cola, False)
Restr += (" " * (24 - len(Restr)))
print('''
┌────────────────────────────┐
│ COLA │
├────────────────────────────┤
│->''' + Restr +'''->│
├────────────────────────────┤
│ 1] VER COLA │
│ 2] AGREGAR ELEMENTO │
│ 3] QUITAR ELEMENTO │
│ 0] SALIR │
└────────────────────────────┘''')
Restr = ""
choice = r.ReadInt(0, 3)
if (choice == 1):
continue
elif (choice == 2):
if (len(cola) < 6):
print("[AGREGAR ELEMENTO]")
while True:
ToQueque = input("[2 CARACTERES MAX]: ")
if (len(ToQueque) < 3 and (ToQueque != "")):
if(len(ToQueque) == 1):
ToQueque += " "
cola.insert(0, ToQueque)
break
else:
Restr = " OVERFLOW ERROR"
elif (choice == 3):
if (len(cola) > 0):
print("[QUITAR ELEMENTO] (" + cola.pop() + ")")
else:
Restr = " UNDERFLOW ERROR"
elif (choice == 0):
print("VOLVIENDO A MENU...")
break