From 3003b120d3c980bc5befd63f0361b3481def0f12 Mon Sep 17 00:00:00 2001 From: ChickenHawkXP <47929127+ChickenHawkXP@users.noreply.github.com> Date: Fri, 29 Oct 2021 14:24:26 -0400 Subject: [PATCH] Added palindrome_checker --- palindrome_checker/palindrome_checker.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 palindrome_checker/palindrome_checker.py diff --git a/palindrome_checker/palindrome_checker.py b/palindrome_checker/palindrome_checker.py new file mode 100644 index 0000000..db31f45 --- /dev/null +++ b/palindrome_checker/palindrome_checker.py @@ -0,0 +1,13 @@ + +if __name__ == "__main__": + import re + + word = input("Enter the word you think is a palindrome: ") + + #Remove spaces and punctuation so phrases work as well + clean_word = re.sub(r'\W', "", word) + + if clean_word.lower() == clean_word[::-1].lower(): + print("That's a palindrome!") + else: + print("Not a palindrome")