CodeMIRAI
0 XP

Palindrome check

Medium +50 XP Solved

Read a line and print Yes if it is a palindrome or No if it is not.

Ignore capital letters, spaces and punctuation, so A man, a plan, a canal: Panama is a palindrome.

Input
racecar
Expected output
Yes
Input
A man, a plan, a canal: Panama
Expected output
Yes
Show a hint

Build a cleaned string with only letters and digits (str.isalnum()), in lower case, then compare it with its reverse.

Show a solution
Python
Loading the editor…
Run the tests to check your solution.