title: Python Lo Shu Magic
body: <p>I am trying to test a Lo Shu Magic Square function, but I am running into a few problems. One of the problems is that I am getting an error message that says TypeError: 'int' object is not iterable, but I do not see what I am doing wrong. Secondly is there a better more efficient way to write this code to check if the lo_shu_square variable is a Lo Shu Magic Square? I am a newb to Python but it just seems inefficient. </p>
  
  <pre><code>ROWS = 3
  COLUMNS = 3
  
  def magic():
      lo_shu_square = [[8, 1, 6],[3, 5, 7],[4, 9, 2]]
      for r in range (ROWS):
          for c in range (COLUMNS):
              if sum(r) == sum (lo_shu_square[c][c] for c in range(COLUMNS)):
                  if sum(r)== sum(r[c] for r in lo_shu_square):
                      answer_output = str('a Lo Shu Magic Square')
              else:
                  answer_output = str('not a Lo Shu Magic Square')
  
      print("The inputs are", answer_output)
  
  magic()
  </code></pre>
  
  <p>The error message:</p>
  
  <pre><code>if sum(r) == sum (lo_shu_square[c][c] for c in range(COLUMNS)):
  TypeError: 'int' object is not iterable
  </code></pre>