the-honk/gcse computer science/year 10/pallindromes/Pallindrome Checker with Punctuation Stripper.py
2021-09-14 21:57:23 +01:00

15 lines
No EOL
352 B
Python

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))