class stack:
def __init__(self):
self.name='stack'
self.list=[]
self.size=0
def push(self,t):
self. list.append(t)
self. size=self.size+1
def empty(self):
return self.size==0
def pop(self):
if(self.empty(self)==True):
print("error")
else:
self.list.remove()
self.size-=1
用python写一个栈
最新推荐文章于 2024-10-08 12:37:10 发布