While trying out code, I have trouble following the difference between return True vs print True and the same with False. If I use return for the True/False statements, nothing gets printed. Why? And if I add a print before the function call I get an output like
>>>True None --8<---------------cut here---------------start------------->8--- def first(word): return word[0] def last(word): return word[-1] def middle(word): return word[1:-1] 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 palin("o") palin("nxon") palin("nooxooxoon") print palin("nabban") --8<---------------cut here---------------end--------------->8--- sivaram -- _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor