I want to make the typical implementation of palindrome function without having to specify the length of the string and its a
and b
as follows
def palindrome(s,a=0,b=len(s)-1):
if a>=b:
return True
return s[a] == s[b] and palindrome(s,a=a+1,b=b-1)
so the user just invoke the function like that palindrome("abcba")
and the b
value gets computed in the first invokation of the recursion to get the value len(s)-1