Sivaram Neelakantan wrote:

def palin(text):
    if first(text) == last(text):
        # print first(text), last(text), middle(text), len(middle(text))
        if len(middle(text)) == 0:
            print True
        else:
            palin(middle(text))
    else:
        print False


Every branch of the function must include a return, or Python will just return None by default. You have three branches. Two of them print a flag. It is easy enough to fix them by changing print to return. The third branch has no return. It needs one.



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to