title: Sum of float numbers in a list in Python
body: <p>I have got float values  in <code>s</code>:</p>
  
  <pre><code>p = list(swn.senti_synsets(a))
  s = p[0].pos_score()
  print(s)
  
  # Output
  0.0
  0.0
  1.0
  0.0
  0.25
  0.25
  </code></pre>
  
  <p>then I tried, <code>print(sum(s))</code>
  which gives the error 'float' object is not Iterable. 
  how to do this ? </p>
  
  <p>Solution: 
  Strange that I found the answer myself, i dont know but putting the thing of a separate function worked. `</p>
  
  <pre><code>for x in token: 
  sum_pos=sum_pos+posCheck(x) 
  sum_neg=sum_neg+negCheck(x) 
  def posCheck(a): 
  p=list(swn.senti_synsets(a)) 
  s = p[0].pos_score() return(s)`
  
  def negCheck(a): p=list(swn.senti_synsets(a)) s = p[0].neg_score() return(s)
  </code></pre>
  
  <p>I couldn't sum up the list, but when I put the function with returntype, it returned the sum of the positive numbers. Thanks to all of you for trying to help.</p>