Skip to content

Commit 44f362f

Browse files
committed
palindrome test now ignore cases
1 parent 3ca97d5 commit 44f362f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

palindrome/palindrome.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ def reverse(string):
1515

1616
def palindrome_test(word):
1717
''' Returns true if a word is palindrome '''
18-
return remove_special_char(word) == reverse(remove_special_char(word))
18+
return remove_special_char(word.lower()) == \
19+
reverse(remove_special_char(word.lower()))
1920

2021

2122
def main():
2223
word = input("Type a word to test if it is palindrome: ")
2324
is_palindrome = palindrome_test(word)
2425
if is_palindrome:
25-
print(f"The word {word} is palindrome")
26+
print(f"The word '{word}' is palindrome")
2627
else:
27-
print(f"The word {word} isn't palindrome")
28+
print(f"The word '{word}' isn't palindrome")
2829

2930

3031
if __name__ == '__main__':

0 commit comments

Comments
 (0)