Lesson 16: What is a palindrome?

posted Apr 3, 2019, 7:53 AM by Attila Lengyel
word = input("Give me a sentence:")
tmp = ""
for i in word:
if i.isalnum():
tmp = tmp + i.lower()
word = tmp
s = ""

for i in word:
s = i + s

print(s)
print(word)

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