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.
2 parents ec1a395 + f8671d8 commit 4f97b9aCopy full SHA for 4f97b9a
palindrome.py
@@ -0,0 +1,16 @@
1
+def is_palindrome(text):
2
+ text=text.lower()
3
+
4
+ cleaned=""
5
+ for char in text:
6
+ if char.isalnum():
7
+ cleaned+=char
8
9
+ reversed_text=cleaned[::-1]
10
+ return cleaned== reversed_text
11
12
+user_input=input("Enter a word or a sentence:")
13
+if is_palindrome(user_input):
14
+ print("It's a palindrome")
15
+else:
16
+ print("It's not a palindrome")
0 commit comments