Back to Practice
#0309

Check a Normalized Palindrome

EasyPython15 min10 XP

Problem

Return True if text is a palindrome after ignoring non-alphanumeric characters and case. Otherwise return False.

Why This Matters

Palindrome checks are a gentle way to learn two pointers, string cleaning, and case-insensitive comparison.

Function Signature

def is_palindrome(text):

Examples

Example 1
Inputtext = "A man, a plan, a canal: Panama"
OutputTrue

After cleaning, the text becomes amanaplanacanalpanama, which reads the same both ways.

Constraints

  • Return the exact requested value.
  • Handle edge cases cleanly.
  • Prefer clear Python code before clever one-liners.
CodePython
Visible browser tests run here when available.
Testcases2 visible / 3 hidden categories
Classic sentence
Input"A man, a plan, a canal: Panama"
ExpectedTrue

Spaces, punctuation, and case are ignored.

Not a palindrome
Input"race a car"
ExpectedFalse

The cleaned text raceacar does not read the same backward.

Hidden Test Categories
empty string after cleaningnumbers mixed with letterssingle character