>>> e = []
>>> def main():
global c
print '*'*34
print '* Stack is First input Last Out *'
print '* Queue is First input First Out *'
print '*'*34
print '1. Insert Stack'
print '2. Delete Stack'
print '3. Show Stack'
print '4. Insert Queue'
print '5. Delete Queue'
print '6. Show Queue'
print '7. EXIT'
print 'Do you choice Number = ',
c = raw_input()
if c == '1':
insert_stack()
elif c == '2':
delete_stack()
elif c == '3':
recent_stack()
elif c == '4':
insert_queue()
elif c == '5':
delete_queue()
elif c == '6':
recent_queue()
else:
ex()
>>> def insert_stack():
print 'Insert to the Stack'
a = raw_input('-->')
b.append(a)
main()
>>> def delete_stack():
d = len(b) - 1
del b[d:]
print 'Last Stack Delete'
print 'Recent Stack is ',
print b
main()
>>> def recent_stack():
print 'Recent Stack'
print b
main()
>>> def insert_queue():
print 'Insert to the Queue'
a = raw_input('-->')
e.append(a)
main()
>>> def delete_queue():
del e[0]
print 'First Queue Delete'
print 'Recent Queue is',
print e
main()
>>> def recent_queue():
print 'Recent Queue'
print e
main()
>>> def ex():
pass
//--- 프로그램 작성 완료
//--------- 실행 예제
>>> main()
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 1
Insert to the Stack
-->222
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 1
Insert to the Stack
-->333
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 3
Recent Stack
['222', '333']
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 7
>>>
Posted by 홍반장