Pybites Logo Rust Platform

Palindrome Check

Easy +2 pts

🎯 In Python, you might check a palindrome like this:

cleaned = "".join(c.lower() for c in s if c.isalnum())
return cleaned == cleaned[::-1]

This exercise is about doing the same thing in Rust — but it's a great chance to practice composing iterator chains, combining the tools you've picked up in the previous exercises.

char methods you'll find useful

Rust's char type has built-in methods that mirror Python's str methods, but they work on individual characters:

'A'.is_alphanumeric()   // true  (like Python's str.isalnum())
'!'.is_alphanumeric()   // false
'A'.to_lowercase()      // an iterator yielding 'a'

One subtlety: char::to_lowercase() returns an iterator, not a single char

Login to see the full exercise.