title: Trouble finding all palindromes
body: <p>I'm trying to write a program that finds all palindromes within a DNA sequence using Python 3.6. I already have a working function that checks whether a sequence of DNA is a palindrome (which is a little different from a word palindrome) , but I can't seem to get the function that should return all palindromes from the DNA sequence to work. Right now, it only returns a list when the DNA sequence in total is a palindrome, but not the palindromes within the DNA sequence. </p>
  
  <p>Just in case: the function to check whether a sequence is a palindrome (which works fine): </p>
  
  <pre><code>def checkPalindrome(DNA):
      converter = DNA.maketrans("ATGC", "TACG")  # finds the complementary strand
      complementary_strand = DNA.translate(converter)
  
        # reverses the complementary strand
      palindrome_check = complementary_strand[::-1] 
      if strand == palindrome_check:
          return True
      else:
          return False
  </code></pre>
  
  <p>And the function that should find all palindromes + the execution code (which doesn't work):</p>
  
  <pre><code>def allPalindromes(DNA):
      left,right = 0,len(DNA)
      j = right
      palindromes = []
  
      while left &lt; right - 1:
          temp = DNA[left:j]
          j -= 1
  
          if checkPalindrome(temp):
              palindromes.append(temp)
  
          if j &lt; left+2:
              left += 1
              j = right
  
      return list(set(palindromes))
  
  strand = getInput()
  all_palindromes = allPalindromes(strand)
  print(all_palindromes)
  </code></pre>