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

14 lines
No EOL
309 B
Python

word = input('Please enter a word!')
def isPallindrome(x):
reverse = ''
i = len(x)
while i > 0:
reverse += x[i - 1]
i = i - 1
return x == reverse
if isPallindrome(word):
print('{0} is a pallindrome!'.format(word))
else:
print('{0} is not a pallindrome!'.format(word))