Update palindrome.py

This commit is contained in:
Sebastian Raschka 2014-04-13 16:26:15 -04:00
parent 0704f2b81c
commit 871f40675f

View File

@ -4,7 +4,7 @@ def palindrome(my_str):
""" """
Returns True if an input string is a palindrome. Else returns False. Returns True if an input string is a palindrome. Else returns False.
""" """
stripped_str = "".join([l.lower() for l in my_str if l.isalpha()]) stripped_str = "".join(l.lower() for l in my_str if l.isalpha())
return stripped_str == stripped_str[::-1] return stripped_str == stripped_str[::-1]
if __name__ == '__main__': if __name__ == '__main__':