Palindrome

Run Settings
LanguagePython
Language Version
Run Command
## is palindrome from string import whitespace, punctuation NON_ALPHANUM: str = whitespace + punctuation def is_palindrome(sentence: str) -> bool: sen = "".join( ch.lower() for ch in sentence if ch not in NON_ALPHANUM) return sen == "".join(reversed(sen)) ##test if __name__ == '__main__': test = ["Ah, Satan sees Natasha!", "Are Mac 'n' Oliver ever evil on camera?", "Python"] for s in test: print(f"{s}. Palindrome: {is_palindrome(s)}")
Editor Settings
Theme
Key bindings
Full width
Lines