code: def entropy(data):
      
  
      if len(data) == 0:
          return None
  
      n = sum(data)
  
      _op = lambda f: f * math.log(f)
      return - sum(_op(float(i) / n) for i in data)
docs: Compute the Shannon entropy, a measure of uncertainty.