I am given word and I have to check if the word is a palindrome. My program works well until I play around with the case of the word.
def isPalindrome(word):
reversedWord = word[::-1]
palindrome = true
for n in range(len(word)):
if(word[n] != reversedWord[i])
palindrome = false
return palindrome
I tried the below code and it works well if I feed the function the word "mom", however it fails when I give it the same word but with a different case "Mom"
def isPalindrome(word):
reversedWord = word[::-1]
palindrome = true
for n in range(len(word)):
if(word[n] != reversedWord[i])
palindrome = false
return palindrome