In the following problem, the recursive function isPalindrome
takes a string as an argument, returning True if the string is a
palindrome and False otherwise. Draw a stack diagram for the program
until the first time at which the program reaches the line marked
with a comment below.
def main():
ans = isPalindrome("badjab")
print ans
def isPalindrome(s):
if len(s) <= 1:
result = True
elif s[0] != s[len(s)-1]:
result = False
else:
result = isPalindrome(s[1:len(s)-1])
# draw stack diagram here
return result
main()