python 데이터 구조의 대기 열 실현
2487 단어 분류 연습
#!/usr/bin/env python
#coding:utf-8
queue = [] // ,
def push(): //
value = raw_input(' : ')
queue.append(value)
choose()
def pop(): //
if len(queue) == 0:
print " "
else:
queue.pop(0)
choose()
def view(): //
print queue
choose()
def showmenu(): //
print '''
u(push):
o(pop):
v(view):
q(quit):
'''
choose()
def choose(): //
choice = raw_input(' : ').lower()
if choice == 'u':
push()
elif choice == 'o':
pop()
elif choice == 'v':
view()
elif choice == 'q':
print '—— ——'
exit()
else:
print ' '
showmenu()
showmenu()