-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueue_Python_Errors.py
More file actions
32 lines (29 loc) · 894 Bytes
/
Queue_Python_Errors.py
File metadata and controls
32 lines (29 loc) · 894 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
def main():
queue = []
while True:
input_line = input()
console_command = (input_line.split(' '))[0]
if console_command == 'push':
number = int(input_line.split(' ')[1])
queue.append(number)
print('ok')
if console_command == 'pop':
if len(queue) != 0:
print(queue.pop(0))
else:
print('error')
if console_command == 'front':
if len(queue) != 0:
print(queue[0])
else:
print('error')
if console_command == 'size':
print(len(queue))
if console_command == 'clear':
del queue[:]
print('ok')
if console_command == 'exit':
print('bye')
break
if __name__ == '__main__':
main()