In [1]:
class Deque:
    def __init__(self):
        self.items = []
        
    def is_empty(self):
        return self.items == []
    
    def add_front(self, item):
        self.items.append(item)
        
    def add_rear(self, item):
        self.items.insert(0, item)
        
    def remove_front(self):
        return self.items.pop()
    
    def remove_rear(self):
        return self.items.pop(0)
    
    def size(self):
        return len(self.items)
In [2]:
d = Deque()
In [3]:
len(d)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-017d7f50046f> in <module>
----> 1 len(d)

TypeError: object of type 'Deque' has no len()
In [4]:
d.size()
Out[4]:
0