len(queue)
should give you the result, 3 in this case.
Specifically, len(object)
function will call object.__len__
method [reference link]. And the object in this case is deque
, which implements __len__
method (you can see it by dir(deque)
).
queue= deque([]) #is this length 0 queue?
Yes it will be 0 for empty deque
.