I have written a palindrome program. And I was just wondering if it correct? I checked using the words racecar and madam, and it says they are palindromes. I have also tested nonpalindrome words and it worked correctly.
Is my implementation correct? If it's not could you correct it for me. It it works correct, is there an easier way to implement this?
def is_palindrome(x):
for i in range(0,len(x)):
x = x.lower()
if x[i::1] == x[::-1]:
return("%s Is a palindrome" %(x))
else:
return("%s Is not a palindrome" %(x))
print(is_palindrome('racecar'))