title: I'm trying to find sum of first n palindromes using python
body: <p>Here's my code:</p>
  <pre><code>def ispalindrome(p):
      temp = p
      rev = 0
      while temp != 0:
          rev = (rev * 10) + (temp % 10)
          temp = temp // 10
      if num == rev:
          return True
      else:
          return False
  
  num = int(input(&quot;Enter a number: &quot;))
  i = 1
  count = 0
  sum = 0
  while (count &lt;= num - 1):
      if (palindrome(i) == True):
          sum = sum + i
          count = count + 1
      i = i + 1
  print(&quot;Sum of first&quot;, num, &quot;palindromes is&quot;, sum)
  </code></pre>
  <p>I believe my ispalindrome() function works. I'm trying to figure out what's wrong inside my while loop.
  here's my output so far:</p>
  <p>n = 1 answer = 1,</p>
  <p>n = 2 answer = 22,</p>
  <p>n = 3 answer = 333 ...</p>
  <p>I also think the runtime on this really sucks
  Please help</p>