If the str is a palindrome, return True; otherwise, return False. Punctuation, spaces, and other non-letters are ignored; their presence or absence should have no effect on the result. Uppercase letters are considered to be equal to their lowercase equivalents.
So my question basically is... How do I "ignore" the punctuation, spaces and other non-letters? I know how to check for the palindrome but yeah... Anyways, thanks =].
So what I had before was just a check for palindrome was this:
def is_palindrome(list):
i = 0
true_or_false = True
while i <= len(list) -1 and true_or_false == True:
if list[i] == list [-1-i]:
true_or_false = True
else:
true_or_false = False
i +=1
return true_or_false
So what can I do to "ignore" the punctuations and stuff?