title: A syntax error when defining variable within a function
body: <pre><code>def isPalindrome(x: int) -&gt; bool:
      #get each digit and save in a list
      num = []
      for i in range(1,11):
          if (x % (10**(i-1) != x)):
              num.append((x % (10**i)) // (10**(i-1)) 
      #reverse the digits
      num_rev = num[::-1]
      #compare
      if (num_rev == num):
          return True
      else:
          return False
             
  </code></pre>
  <p>SyntaxError: invalid syntax</p>
  <p>Why I have syntax error when defining the variable num_rev? Thanks</p>