Check if a string is a palindrome
Compare a Python string with its reversed slice to check whether it is a palindrome.
Slicing is the way to go.
def isPalindrome(s): return s == s[::-1]Compare a Python string with its reversed slice to check whether it is a palindrome.
Slicing is the way to go.
def isPalindrome(s): return s == s[::-1]