class Quene():
"""队列"""
def __init__(self):
self.__list = []
def enqueue(self,item):
"""往队列中添加元素"""
self.__list.append(item)
def dequeue(self):
"""从队列头部删除一个数据"""
if self.__list:
return self.__list.pop(0)
else:
return None
def is_empty(self):
"""判断一个队列是否为空"""
return self.__list == []
def size(self):
"""返回队列大小"""
return len(self.__list)
if __name__ == '__main__':
s = Quene()
print(s.dequeue())
s.enqueue(1)
s.enqueue(2)
s.enqueue(3)
s.enqueue(4)
print(s.dequeue())
print(s.dequeue())
print(s.dequeue())
print(s.dequeue())
print(s.is_empty())
print(s.size())