title: python: help in calculation a proportion of 1's in binary sequence
body: <p>I am writing a program in python. It randomly generates binary strings of length 10 for host and length 7 for parasites. What i need to do now is find the proportion of 1's  in  each parasite genome and total proportion of 1's in the entire parasite population</p>
  
  <pre><code>import random
  host_genome_length = 10
  parasite_genome_length = 5
  host_initial_population=15
  parasite_initial_population=10
  assert   parasite_initial_population &gt;=0
  parasite_initial_chance_1= 0.2
  host_initial_chance_1=0.5
  hosts=[]
  for i  in range(host_initial_population):
      genome= []
      for j in range (host_genome_length):
          if random.random()&lt; host_initial_chance_1:
              genome.append(1)
          else:
              genome.append(0)
      hosts.append(genome)
  print "hosts:"
  print  hosts
  
  parasites=[]
  for i  in range(parasite_initial_population):
      genome= []
      for j in range (parasite_genome_length):
          if random.random()&lt; parasite_initial_chance_1:
              genome.append(1)
          else:
              genome.append(0)
      parasites.append(genome)
  
  for i in range(host_initial_population-parasite_initial_population):
      parasites.append(None)
  print "parasites:"
  print parasites
  </code></pre>
  
  <p>for example if the output is [1, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 1, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 1, 0], None, None, None, None, None]</p>
  
  <p>i need proportion of 1's in each sequence
  and total proportion of 1 in the entire list?</p>