title: How to create multiset data structure in python
body: <p>I was trying to solve some of hackerrank questions where I got one question related to multiset. I tried this code but I little bit confused about at which point am I making mistake?</p>
  <pre><code>class Multiset:
      def __init__(self):
          self.items=[]
  
      def add(self, val):
          # adds one occurrence of val from the multiset, if any
          self.items.append(val)
      
  
      def remove(self, val):
          # removes one occurrence of val from the multiset, if any
          if len(self.items):
              if val in self.items:
                  self.items.remove(val)
  
      def __contains__(self, val):
          if val in self.items:
              return True
          return False
          
      
      def __len__(self):
          # returns the number of elements in the multiset
          return len(self.items)
  
  if __name__ == '__main__':
  
  </code></pre>