the-honk/school/gcse/year 10/pallindromes/Pallindrome Checker with Punctuation Stripper.py

15 lines
352 B
Python
Raw Normal View History

2024-10-09 17:02:27 +00:00
word = input('Please enter a word!')
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
nopunc = ''
for i in word:
if i not in punctuations:
nopunc = nopunc + i
def isPallindrome(x):
return x == x[::-1]
if isPallindrome(nopunc):
print('{0} is a pallindrome!'.format(word))
else:
print('{0} is not a pallindrome!'.format(word))