We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c92a520 commit 4b78c69Copy full SHA for 4b78c69
strings/is_palindrome.py
@@ -0,0 +1,19 @@
1
+def is_palindrome(s):
2
+ """
3
+ Determine whether the string is palindrome
4
+ :param s:
5
+ :return: Boolean
6
+ >>> is_palindrome("a man a plan a canal panama".replace(" ", ""))
7
+ True
8
+ >>> is_palindrome("Hello")
9
+ False
10
11
+ return s == s[::-1]
12
+
13
14
+if __name__ == "__main__":
15
+ s = input("Enter string to determine whether its palindrome or not: ").strip()
16
+ if is_palindrome(s):
17
+ print("Given string is palindrome")
18
+ else:
19
+ print("Given string is not palindrome")
0 commit comments