class Solution:
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
if s == "":
return True
else:
new_string = s
new_string = new_string.lower()
new_list = []
for i in new_string:
if (ord(i) >= 97 and ord(i) <= 122) or (ord(i) >= 48 and ord(i) <= 57):
new_list.append(i)
new_string = ("").join(new_list)
print (new_string)
if new_string == new_string[::-1]:
return True
else:
return False
No comments:
Post a Comment