title: How to fix "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'"
body: <p>I'm creating a program that calculates the weight on top of each person in a human pyramid, assuming each person conveniently weighs 200 pounds. My problem is the last 'elif' in my function, which brings up the error: TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'.</p>
  
  <p>This needs to be a recursive function for my class.</p>
  
  <p>I've tried a 'return' statement already and 'tot =' instead of 'tot +='.</p>
  
  <pre><code>tot = 0.0
  
  def prac(r, c):
  
      global tot
      if c &gt; r:
          print('Not valid')
      elif r == 0 and c &gt;= 0:
          print(tot, 'lbs')
      elif r &gt; 0 and c == 0:
          tot += (200 / (2 ** r))
          prac(r - 1, c)
      elif r &gt; 0 and c == r:
          tot += (200 / (2 ** r))
          prac(r - 1, c - 1)
      elif r &gt; 0 and r &gt; c &gt; 0:
          tot += (200 + (prac(r - 1, c - 1)) + (prac(r - 1, c)))
          prac(r == 0, c == 0)
  
  
  
  prac(2, 1)
  </code></pre>
  
  <p>I expect it to calculate prac(2,1) to 300 lbs , prac(3,1) to 425, etc.</p>