passes 30/72 tests

This commit is contained in:
Jacob Delgado 2023-08-28 23:45:49 -07:00
parent 3a53e85da2
commit 9544d64f85

View File

@ -1,8 +1,22 @@
import string
def isPalindrome(s):
"""
:type s: str
: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"))