We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a05c40a commit 47e4acaCopy full SHA for 47e4aca
useful_scripts/palindrome.py
@@ -0,0 +1,14 @@
1
+# Sebastian Raschka 04/2014
2
+
3
+def palindrome(my_str):
4
+ """
5
+ Returns True if an input string is a palindrom
6
7
+ stripped_str = "".join([l.lower() for l in my_str if l.isalpha()])
8
+ return stripped_str == stripped_str[::-1]
9
10
+if __name__ == '__main__':
11
+ test1 = 'Hello World!'
12
+ test2 = "Go hang a salami. I'm a lasagna hog."
13
+ print('test1', palindrome(test1))
14
+ print('test2', palindrome(test2))
0 commit comments