Note: Items added to this Queue ADT will consist only of strings of length one.
- __init__(self)
- Initializes a new Queue object
- enqueue(self,item)
- Adds item to the back of the queue and returns None.
- dequeue(self)
- Removes the character at the front of the queue and returns it. Returns None if the queue is empty.
- is_empty(self)
- Returns True if the queue is empty and False otherwise.
- __str__(self)
- Returns a string representation of the queue.
Output: abcdq = Queue() for c in "abcd": q.enqueue(c) print(q)
Output: bq = Queue() for c in "abcd": q.enqueue(c) q.dequeue() print(q.dequeue())
Output: Falseq = Queue() for c in "abcd": q.enqueue(c) q.dequeue() q.dequeue() print(q.is_empty())
Output: deepq = Queue() for c in "hide": q.enqueue(c) q.dequeue() q.dequeue() q.enqueue("e") q.enqueue("p") print(str(q))