I am learning Python and came across a beautiful recursive function to determine if a string is a palindrome but when I try to reproduce the solution by myself, I came up with this very inelegant solution. Do you call this a recursive function or an iterative function? I would appreciate any ideas about how to think "recursively"?
def pal(s,i):
if len(s)//2 ==i:
return True
else:
if s[i] != s[len(s)-1-i]:
return False
else:
i=i+1
return((pal(s,i)))
print(pal ("abccba",0))