title: How to get mean from list that is partially empty example [0,2,4,0,4,0,0,0,0,10]
body: <p>How to get mean from list that is partially empty example <code>[0,2,4,0,4,0,0,0,0,10]</code></p>
  
  <p>So mean should be <code>(2+4+4+10)/4 = 5</code> , but <code>statistics.mean()</code> divides by the overall amount of numbers in the list (which in this case is 10).</p>
  
  <p>So in my case I need to get mean from the list of numbers which are divisible by 3 (list b) </p>
  
  <pre><code>import random
  import statistics
  
  a = []
  b = []
  c = [0,2,4,0,4,0,0,0,0,10]
  for x in range (10):
      a.append(random.randint(0,101))
  
  for x in a:
      if x%3==0:
          b.append(x)
      else:
          b.append(0)
  
  average = statistics.mean(b)
  
  print('a',a)
  print('b',b)
  print('Srednia',average)
  </code></pre>