title: LeetCode Reverse Integer (ValueError: invalid literal for int() with base 10: '' )
body: <p><strong>Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2**31, 2**31 - 1], then return 0.</strong></p>
  <p>Assume the environment does not allow you to store 64-bit integers (signed or unsigned).</p>
  <p>This is my submission</p>
  <pre><code>class Solution(object):
  def reverse(self, x):
      sp= str(abs(x))[::-1].lstrip(&quot;0&quot;)
      ans= int(sp)
      
      if x &gt; 0 :
          return ans
      else: 
          return -1*ans
  </code></pre>
  <p>The int() method should allow me to pass a string value (&quot;12&quot;), but it returns an error saying that it's an invalid literal for int().</p>
  <p>The variable <strong>sp</strong> in line 3 is <strong>a str not a float</strong>, so I have no idea why it doesn't run on the leetcode submission page, as it runs ok on VSCode.</p>
  <p>Is there any grading guideline that I missed?</p>
  <p>And, this is the Value Error I'm getting</p>
  <p><a href="https://i.stack.imgur.com/wMbkN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wMbkN.png" alt="enter image description here" /></a></p>