Test a Palindrome Check
Write the tests · Intermediate · about 12 min
is_palindrome(text) returns True when text reads the same forwards and backwards once capitals and spaces are ignored, and False otherwise. Spaces are the only characters it ignores, and an empty string counts as a palindrome.
Write test_ functions with assert that pass on a correct version and fail on broken ones.
Examples
is_palindrome("level") # True is_palindrome("Top spot") # True is_palindrome("python") # False
def test_simple_word():
assert is_palindrome("level") == True
The solution opens after your first Check.