20 lines
372 B
Python
20 lines
372 B
Python
def palindrome_check(word: str, front: int = 0):
|
|
|
|
back = len(word)-1 - front
|
|
print(word[front], word[back])
|
|
|
|
if front >= back:
|
|
print("Palindrome")
|
|
|
|
elif word[front] == word[back]:
|
|
front += 1
|
|
palindrome_check(word, front)
|
|
|
|
|
|
|
|
word = input("Enter a word: ")
|
|
word = word.casefold()
|
|
word = word.replace(" ", "")
|
|
|
|
palindrome_check(word)
|