# coding:utf-8
class Queue(object):
"""隊列"""
def __init__(self):
self.__list = []
the enqueue DEF (Self, item):
"" "add an item to the queue element" ""
Self .__ list.append (item)
dequeue DEF (Self):
"" "removes an element from the head of the queue" ""
return Self .__ list.pop (0)
is_empty DEF (Self):
"" "determines whether a queue is empty" ""
return Self .__ List == []
size DEF (Self):
"" "returns the size of the queue" ""
return len (Self .__ List)
if __name__ == "__main__":
s = Queue()
s.enqueue(1)
s.enqueue(2)
s.enqueue(3)
s.enqueue(4)
print(s.dequeue())
print(s.dequeue())
print(s.dequeue())
print(s.dequeue())