Check if Palindrome

Check if a string is a palindrome by comparing characters from both ends.

Code

Algorithms
import re
clean = re.sub(r'[^a-z0-9]', '', s.lower())
return clean == clean[::-1]

Parameters

The string to check

Server

More Python Snippets