I've just started Python and need to write a program that tells if a string is a palindrome. Here is what I have so far.
def palp(word):
if len(word) < 2:
return True
left_index = (0)
right_index = len(word) - 1
while len(left_index) <> len(right_index):
return False
if left_index == right_index:
left_index + 1
right_index - 1
return True
I don't know but for some reason it doesn't return true for any palindrome except for ones with only one letter.