title: While loop in python and error ValueError: invalid literal for int() with base 10: ''
body: <p>I am trying to test if a number is divisible by 11 or not. Here's my code:</p>
  
  <pre><code>def divisible_by_11(s):
      '''Returns True if the number represented by the string s is
      divisible by 11, False otherwise.'''
      p = str(s)
      b = int(str(s)[-1])
      c = int(str(s)[-2])
      total = 0
      motal = 0
      while len(p) &gt; 0:
                a = int(str(s)[:-2])
                b = int(str(s)[-1])
                c = int(str(s)[-2])
                total = total + b
                motal = motal + c
                s = a
                p = str(s)
      return (total-motal) % 11 ==0
  </code></pre>
  
  <p>But I am getting error</p>
  
  <pre><code>a = int(str(s)[:-2])
  ValueError: invalid literal for int() with base 10: ''
  </code></pre>
  
  <p>Can anyone please help me?
  Thanks in advance.</p>