Python strings and palindrome checks
Strings are immutable sequences. A slice creates a new string; [::-1] reverses its order.
Python
def is_palindrome(text):
cleaned = text.lower().replace(" ", "")
return cleaned == cleaned[::-1]
print(is_palindrome("Never odd or even"))
print(is_palindrome("Python"))
assert is_palindrome("") is True