title: How to check if tree is symmetric python
body: <p>For practice, I solved Leetcode <a href="https://leetcode.com/problems/symmetric-tree/" rel="nofollow noreferrer">101. Symmetric Tree</a> question:</p>
  <blockquote>
  <p>Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).</p>
  </blockquote>
  <p>I have an idea to do in order traversal, record each node value into list and check the value from the first part, and reverse the second part from the list. But
  it failed on test case <strong>[1,2,3,3,null,2,null]</strong>
  from my local, my value return <strong>[3, 2, None, 1, 2, 3, None]</strong>, but from leetcode it return <strong>[3,2,1,2,3]</strong> anyone know why and anything wrong with my code?</p>
  <pre><code>def isSymmetric(root: 'TreeNode') -&gt; 'bool':
  
      if not root: return True
      value = []
  
      def traversal(cur):
          if cur:
              traversal(cur.left)
              value.append(cur.val)
              traversal(cur.right)
  
      traversal(root)
      size = int(len(value) / 2)
      return value[:size] == value[size + 1:][-1::-1]
  </code></pre>