Lesson 16: What is a palindrome?

posted Apr 5, 2019, 8:04 AM by Attila Lengyel
def eliminate(w):
tmp = ""
for i in w:
if i.isalnum():
tmp = tmp + i.lower()

return tmp

word = input("Give me a word:")
word = eliminate(word)

reverse = ""
for i in word:
reverse = i + reverse
print(reverse)

if word == reverse:
print("This is a palindrome")
else:
print("This is not a palindrome")


Comments