Skip to content

Commit debf9d8

Browse files
feat: add palindrome checker script
1 parent ae68a78 commit debf9d8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

scripts/palindrome_checker.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# palindrome_checker.py
2+
# Simple palindrome checker
3+
# Author: Ananth Sai
4+
5+
def is_palindrome(s: str) -> bool:
6+
s = "".join(ch.lower() for ch in s if ch.isalnum())
7+
return s == s[::-1]
8+
9+
def main():
10+
text = input("Enter a word or phrase: ").strip()
11+
if is_palindrome(text):
12+
print(f"✅ '{text}' is a palindrome!")
13+
else:
14+
print(f"❌ '{text}' is not a palindrome.")
15+
16+
if __name__ == "__main__":
17+
main()

0 commit comments

Comments
 (0)