Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def push(A, n):
- A.append(n)
- print('ok')
- def pope(A):
- if len(A) == 0:
- print('error')
- return None
- print(A[0])
- A.pop(0)
- def size(A):
- print(len(A))
- def front(A):
- if len(A) == 0:
- print('error')
- return None
- print(A[0])
- def clear(A):
- A.clear()
- print('ok')
- A = []
- inp = ' '
- while inp[0] != 'exit':
- inp = input().split()
- if inp[0] == 'push':
- push(A, inp[1])
- elif inp[0] == 'pop':
- pope(A)
- elif inp[0] == 'size':
- size(A)
- elif inp[0] == 'front':
- front(A)
- elif inp[0] == 'clear':
- clear(A)
- print('bye')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement