input: Write a class in Python that can find the median of an unsorted list of numbers. The class should have methods to add numbers to the list and to find the median of the list. The median should be calculated as the average of the two middle numbers if the list length is even, or the middle number if the list length is odd. If the list is empty, return 0.
  
  class MedianFinder:
   def __init__(self):
       self._data = []
   
   def add(self, num):
       self._data.append(num)
   
   def find_median(self):
       if not self._data:
           return 0
       data = sorted(self._data)
       n = len(data)
       if n % 2 == 0:
           return (data[(n-1)//2] + data[n//2])/2
       else:
           return data[n//2]
  
  assert MedianFinder().add(3).add(1).add(2).find_median() == 2
  assert MedianFinder().add(5).add(2).add(4).add(1).add(3).find_median() == 3
  assert MedianFinder().add(7).add(3).add(9).add(1).find_median() == 5
  assert MedianFinder().add(8).add(4).add(10).add(2).add(6).find_median() == 6
  assert MedianFinder().find_median() == 0
output: 
  class MedianFinder:
   def __init__(self):
       self._data = []
   
   def add(self, num):
       self._data.append(num)
       return self
   
   def find_median(self):
       if not self._data:
           return 0
       data = sorted(self._data)
       n = len(data)
       if n % 2 == 0:
           return (data[(n-1)//2] + data[n//2])/2
       else:
           return data[n//2]
  