Skip to content

Instantly share code, notes, and snippets.

@colegleason
Created October 8, 2010 19:14
Show Gist options
  • Save colegleason/617358 to your computer and use it in GitHub Desktop.
Save colegleason/617358 to your computer and use it in GitHub Desktop.
what is this i don't even
text = open('gettysburg.txt','r').read()
for x in reversed(range(len(text))):
print "Now on length " + str(x)
done = False
substring = text[0:x]
for i in range((len(text) + 1) - x):
print "Now on position " + str(i)
if x+i <= len(text):
substring = text[0+i:x+i]
if substring == substring[::-1]:
print substring
done = True
break
else:
pass
if done: break
else: pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment