forked from RadiantCoding/Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueues.py
More file actions
34 lines (33 loc) · 835 Bytes
/
Queues.py
File metadata and controls
34 lines (33 loc) · 835 Bytes
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
queue=[]
def view():
for x in range(len(queue)):
print(queue[x])
def push():
item = input("Please enter the item you wish to add to the Queue: ")
queue.append(item)
def pop():
item = queue.pop(0)
print("You just popped out",item)
def peek():
item = queue[0]
print("You peeked",queue[0])
while True:
print("")
print("=========================")
print("1. View Queue")
print("2. Push onto Queue")
print("3. Pop out of Queue")
print("4. Peek Queue")
print("=========================")
print("")
choice=int(input("Please enter your menu choice: "))
if choice == 1:
view()
elif choice ==2:
push()
elif choice ==3:
pop()
elif choice ==4:
peek()
else:
print("Invalid Input")