title: how to divide each element in a list of lists by a number in python
body: <p>I have a list of list 'q' and i want to divide each number in q by the sum in each list (=10)
  I tried this:</p>
  
  <pre><code>q = [[0,0,0,10],[1,2,6,1]]
  B=[]
  for x in q:
      y = [z/sum(x[:len(x)]) for z in x]
      B.append(y)   
  print B
  </code></pre>
  
  <p>It does not give me the expected result</p>
  
  <p>anyone knows whats wrong here?</p>