Ad
Code
Diff
  • def is_palindrome(s: str) -> bool:
        s = ''.join(l for l in s.lower() if 96 < ord(l) < 123)
        return s == s[::-1]
    • import string
    • def is_palindrome(s: str) -> bool:
    • forward = s.lower().replace(" ", "").translate(str.maketrans('', '', string.punctuation))
    • reverse = forward[::-1]
    • if forward == reverse:
    • return True
    • else:
    • return False
    • s = ''.join(l for l in s.lower() if 96 < ord(l) < 123)
    • return s == s[::-1]