Skip to content

Instantly share code, notes, and snippets.

@mattliving
Created June 4, 2012 19:43
Show Gist options
  • Save mattliving/2870418 to your computer and use it in GitHub Desktop.
Save mattliving/2870418 to your computer and use it in GitHub Desktop.
palindromic Python algorithm
#!/usr/bin/env
def palin(s):
j = len(s)
if j == 1:
return True
i = 0
while i <= j:
if s[i] != s[j-1]:
return False
i += 1
j -= 1
return True
print palin("1101011")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment