title: 'float' object can't be interpreted as int, but converting to int yields no output
body: <p>So I'm trying to test if something is a palindrome. Here is my code:</p>
  
  <p>This function returns a string of the first half of a larger string. ("TEST" returns "TE", "HELLO" returns "HE")</p>
  
  <pre><code>def takeStart(s):
      start = ""
  
      # The following determines the final index of the first half
  
      if len(s)%2==0:  
          a = (len(s)/2)-1
      else:
          a = ((len(s)-1)/2)-1
  
      for i in range(a):
          start+=s[i]
      return start
  </code></pre>
  
  <p>This function returns a string of the second half of a larger string. ("TEST" returns "ST", "HELLO" returns "LO")</p>
  
  <pre><code>def takeEnd(s):  
      end = ""
  
      # The following determines the beginning index of the second half
  
      if len(s)%2==0:
          a = (len(s)/2)
      else:
          a = ((len(s)-1)/2)
  
      for i in range(a,len(s)):
          end+=s[i]
      return end
  </code></pre>
  
  <p>This function flips a string. ("TEST" returns "TSET", "HELLO" returns "OLLEH")</p>
  
  <pre><code>def flip(s):
      flipped = ""
      for i in range(1,len(s)):
          flipped+=s[len(s)-i]
      flipped+=s[0]
      return flipped
  </code></pre>
  
  <p>This code takes every product of two 3-digit numbers, and checks if it's a palindrome</p>
  
  <pre><code>for i in range(100,1000):
      for q in range(100,1000):
          a = i*q
          if takeStart(str(a)) == flip(takeEnd(str(a))):
              print(str(a))
  </code></pre>
  
  <p>When this code is run, it outputs:</p>
  
  <pre><code>Traceback (most recent call last):
    File "[redacted]", line 39, in &lt;module&gt;
      if takeStart(str(a)) == flip(takeEnd(str(a))):
    File "[redacted]", line 14, in takeStart
      for i in range(a):
  TypeError: 'float' object cannot be interpreted as an integer
  </code></pre>
  
  <p>Alright, I thought I just convert a to an integer and all should be swell.</p>
  
  <p>Doing that appears to remove all errors, but there is NO output whatsoever. (There are new lines every once and a while which makes me think it's working but not outputing any data)</p>
  
  <p>Any ideas on why this is happening?</p>
  
  <p>UPDATE: my code now:</p>
  
  <pre><code>def takeStart(s):
      start = ""
      if len(s)%2==0:
          a = (len(s)//2)
      else:
          a = (len(s)-1)//2
      return start[0:a]
  
  def takeEnd(s):  
      end = ""
      if len(s)%2==0:
          a = (len(s)//2)
      else:
          a = ((len(s)-1)//2)
  
      return end[int(a):len(s)]
  
  def flip(s):
      return s[::-1]
  
  for i in range(100,1000):
      for q in range(100,1000):
          a = i*q
          if takeStart(str(a)) == flip(takeEnd(str(a))):
              print(str(a))
  </code></pre>
  
  <p>This is just outputting every single number.
  I tested each method and they're returning empty strings. (I'm assuming), which is why every number is passing the palindrome check and printing.</p>