Skip to content

Instantly share code, notes, and snippets.

@MaxMonteil
Created April 2, 2019 14:25
Show Gist options
  • Save MaxMonteil/ab007fcc1a008ea546dd036c986ae031 to your computer and use it in GitHub Desktop.
Save MaxMonteil/ab007fcc1a008ea546dd036c986ae031 to your computer and use it in GitHub Desktop.
Say whether a given string is a palindrome or not
def palindrome(string):
alphanum = "abcdefghijklmnopqrstuvwxyz0123456789"
clean = "".join([c for c in string.lower() if c in alphanum])
return clean == clean[::-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment