Advertisement
Bad_Programist

Untitled

Jan 28th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. def push(A, n):
  2.     A.append(n)
  3.     print('ok')
  4. def pope(A):
  5.     if len(A) == 0:
  6.         print('error')
  7.         return None
  8.     print(A[0])
  9.     A.pop(0)
  10. def size(A):
  11.     print(len(A))
  12. def front(A):
  13.     if len(A) == 0:
  14.         print('error')
  15.         return None
  16.     print(A[0])
  17. def clear(A):
  18.     A.clear()
  19.     print('ok')
  20.  
  21. A = []
  22. inp = ' '
  23. while inp[0] != 'exit':
  24.     inp = input().split()
  25.     if inp[0] == 'push':
  26.         push(A, inp[1])
  27.     elif inp[0] == 'pop':
  28.         pope(A)
  29.     elif inp[0] == 'size':
  30.         size(A)
  31.     elif inp[0] == 'front':
  32.         front(A)
  33.     elif inp[0] == 'clear':
  34.         clear(A)
  35. print('bye')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement