4 ms·
Or even more clearly def is_palindrome(str): return str == str[::-1]
by paulddraper 10y ago
Or even more clearly
def is_palindrome(str):
return str == str[::-1]
- eru 10y agoAccording to the authors spec, you have to filter out spaces, normalize capitalisation etc. So your solutions works after a preprocessing step.
- paulddraper 10y agoCorrect, I wrote this based on the parent's desired answer.