Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created June 25, 2015 17:34
Show Gist options
  • Save mattdeboard/bc3ebca3b8f60499a29a to your computer and use it in GitHub Desktop.
Save mattdeboard/bc3ebca3b8f60499a29a to your computer and use it in GitHub Desktop.
def palindrome_test2(candidate):
if not isinstance(basestring, candidate):
raise TypeError("The argument to this function must be a string.")
alphanum_chars = [l for l in candidate if l != " "]
for idx, i in enumerate(alphanum_chars, 1):
if i == alphanum_chars[-idx]:
continue
else:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment