Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread bob gailer
On 2/4/2012 11:53 AM, Steven D'Aprano wrote: [snip] In the interactive interpreter, as a convenience, the result of each line is automatically printed for you: Actually the interpreter prints the result of each /statement /that IS an /expression/. >>> 2 2 >>> a = 3 >>> a 3 IOW if the line i

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Brett Ritter
On Sat, Feb 4, 2012 at 11:42 AM, Sivaram Neelakantan wrote: > On Sat, Feb 04 2012,bob gailer wrote: > >> On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote: >>> While trying out code, I have trouble following the difference between >>> >>> return True vs print True and the same with False.  If I use r

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Steven D'Aprano
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 br

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Steven D'Aprano
Sivaram Neelakantan wrote: 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? Probably because you aren't printing anything. Python can't read your

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Sivaram Neelakantan
On Sat, Feb 04 2012,bob gailer wrote: > On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote: >> 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?

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread bob gailer
On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote: 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? Why did you expect something to be printed? Per

[Tutor] Return T/F vs print T/F

2012-02-04 Thread Sivaram Neelakantan
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<---