Skip to content

Instantly share code, notes, and snippets.

@LivingInSyn
Last active September 29, 2016 21:31
Show Gist options
  • Save LivingInSyn/c96e2dbabb781424630460052e981d39 to your computer and use it in GitHub Desktop.
Save LivingInSyn/c96e2dbabb781424630460052e981d39 to your computer and use it in GitHub Desktop.
finding palindrome substrings with python
def palindrome(input):
length = len(input)
palindromes = []
for x in range(2,len(input)+1):
min = 0
while (min+x) < length+1:
if(input[min:(min+x)] == input[min:(min+x)][::-1]):
palindromes.append(testString)
min = min+1
return palindromes
print(palindrome("ninanin"))
print(palindrome("nnn"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment