Suppose we have a string s. We have to check whether this string contains some even length palindrome or not.
So, if the input is like s = "afternoon", then the output will be True as "afternoon" has even length palindrome "noon".
To solve this, we will follow these steps:
Let us see the following implementation to get better understanding −
def solve(string): for i in range (0, len(string)): if (string[i] == string[i + 1]): return True return False s = "afternoon" print(solve(s))
"afternoon"
True