Ad
Code
Diff
  • def is_palindrome(s: str) -> bool:
        return (x := [*map(lambda z: z.lower(),filter(lambda y: y.isalpha(),[*s]))]) == x[::-1] 
    • import string
    • def is_palindrome(s: str) -> bool:
    • forward = s.lower().translate(str.maketrans('', '', string.punctuation + ' '))
    • return forward == forward[::-1]
    • return (x := [*map(lambda z: z.lower(),filter(lambda y: y.isalpha(),[*s]))]) == x[::-1]