passes 30/72 tests
This commit is contained in:
parent
3a53e85da2
commit
9544d64f85
@ -1,8 +1,22 @@
|
|||||||
|
import string
|
||||||
|
|
||||||
def isPalindrome(s):
|
def isPalindrome(s):
|
||||||
"""
|
"""
|
||||||
:type s: str
|
:type s: str
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
"""
|
"""
|
||||||
|
# Create a translation table to remove uppercase letters and special characters
|
||||||
|
translation_table = str.maketrans("", "", string.ascii_uppercase + string.punctuation + string.whitespace)
|
||||||
|
|
||||||
|
# Use the translation table to remove uppercase letters and special characters
|
||||||
|
cleaned_string = s.translate(translation_table)
|
||||||
|
|
||||||
|
half = len(cleaned_string)/2
|
||||||
|
|
||||||
|
first = []
|
||||||
|
second = []
|
||||||
|
for i in range(len(half)):
|
||||||
|
|
||||||
|
return cleaned_string
|
||||||
|
|
||||||
print(isPalindrome("A man, a plan, a canal: Panama"))
|
print(isPalindrome("A man, a plan, a canal: Panama"))
|
||||||
Loading…
Reference in New Issue
Block a user