Does the peek() method for the Queue class modify the queue?


#1

Question

When the peek() method is called in this exercise, does it modify the queue?

Answer

NO. The peek() method is intended to return the value of the current top of the queue but it does not modify or change that value. If the queue has items in it, then peek() will return the value, otherwise a None is returned.