Python for beginners - Palindrome function

preview_player
Показать описание
in this video I show you how to make a function that determines whether or not the word or phrase you entered is in fact a palindrome

a palindrome is a word or phrase that is read the same forwards as it is backwards
Рекомендации по теме
Комментарии
Автор

Very imformative video. Great channel.

cincyohio
Автор

test_text = str(input("Enter a word or phrase: "))

test_reverse = ", "").replace(", ", "")
test_reverse = test_text[::-1]
test_reverse = test_text

if len(test_text) >= 2:
if test_text == test_reverse:
print ("The word", '"', "is a palindrome.")
else:
print ("The word", '"', test_text, '"', "is not a palindrome.")
else:
print "The word is too short? Choose another word."

text_text = "kayak"

test_reverse = test_text[...]

if test_text == test_reverse:
print ("The word", test_text, "is a palindrome.")
else:
print ("The word", test_text, "is not a palindrome.")

Could you fix this code as all words are returning is a palindrome.
Thanks

mw