Created
April 2, 2019 14:25
-
-
Save MaxMonteil/ab007fcc1a008ea546dd036c986ae031 to your computer and use it in GitHub Desktop.
Say whether a given string is a palindrome or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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