[Tutor] Actual code that illustrates problem
Kent Johnson
kent37 at tds.net
Fri Aug 18 12:52:06 CEST 2006
Alan Gauld wrote:
>>>> # print " "
>>>> # print " In strongfac "
>>>> # print " Found1: x = ",x
>>>>
>>> You could do all of this with a single print:
>>>
>>> print "\n In strongfac \nFound1: x = ", x
>>>
>>>
>> uuuuuuuuuh.. Too compact for me.
>> I need to see the logic more spread out.
>>
>
> \n is the newline character.
> An alternative is to use triple quotes:
>
> print '''
> In strongfac
> Found1: x = ''',x
>
> But that still clutters up the code listing with extra lines that
> have nothing to do with the algorithm - the main advantage in
> reducing to one print statement..
This is obviously a matter of personal preference. I prefer the longer
form as well - I usually use a separate print statement for each line of
output. I would say it has everything to do with the function, if not
the algorithm - it clearly represents the form the output will take.
Kent
More information about the Tutor
mailing list