Created
January 28, 2022 23:51
-
-
Save frantizek/1c8fd8897965b1d112f1ebca114c2988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def palindrome_test(phrase): | |
cleanString = re.sub('\W+', '', phrase.lower()) | |
return cleanString == cleanString[::-1] | |
while True: | |
user_entry = input("Enter string to test for palindrome or 'exit' : ") | |
if user_entry.lower() == 'exit': | |
break | |
else: | |
print("Palindrome test:", palindrome_test(user_entry)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment