在学习python的过程中,用来练习代码,并且复习数据结构的
#coding:utf-8
#author:Elvis
class Stack(object):
def __init__(self, size=8):
self.stack = []
self.size = size
self.top = -1
def is_empty(self):
if self.top == -1:
return True
else:
return False
def is_full(self):
if self.top +1 == self.size:
return True
else:
return False
def push(self, data):
if self.is_full():
raise Exception('stackOverFlow')
else:
self.top += 1
self.stack.append(data)
def stack_pop(self):
if self.is_empty():
raise Exception('stackIsEmpty')
else:
self.top -= 1
return self.stack.pop()
def stack_top(self):
if self.is_empty():
raise Exception('stackIsEmpty')
else:
return self.stack[self.top]
def show(self):
print self.stack
stack = Stack()
stack.push(1)
stack.push(2)
stack.push('a')
stack.push('b')
stack.push(5)
stack.push(6)
stack.stack_pop()
stack.stack_pop()
stack.stack_top()
stack.is_empty()
stack.is_full()
stack.show()
以上所述就是本文给大家分享的全部内容了,希望大家能够喜欢。
可以实现用户的在线注册、登陆后可以添加图书、购买图书,可以对图书类别、出版社、价格等进行饼图分析默认帐号/密码:51aspx/51aspx该系统采用三层接口开发,App_Code下为三层结构的代码文件,适合三层入门者学习使用数据绑定控件使用的是GridView,顶部公用文件采用了UserControl用户控件调用DB_51aspx下为Sql数据库文件,附件即可【该源码由51aspx提供】
0
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号