Problem Explanation
You are given a string and you have to tell if it is a Palindrome. Palindromes are strings that are the same when reversed.
Approach
Palindromes are mirrored in the middle. So we can check if the 0^{th} index character is the same as the (n-1)^{th} character, the 1^{st} character is the same as the (n-2)^{th} character and so on untill the middle which is n/2. So we iterate from the beginning of the string till the middle and check for every i, the i^{th} character is equal to the (n-i-1)^{th} character or not. If not then we output that it is not a palindrome and if the whole string is iterated then it is a Palindrome.
Code
def check_palindrome(s, n):
if(n>len(s)//2):
return "Yes"
if(s[n]!=s[len(s)-n-1]):
return "No"
return check_palindrome(s, n+1)