[Tutor] Actual code that illustrates problem

Alan Gauld alan.gauld at freenet.co.uk
Fri Aug 18 09:47:54 CEST 2006


>>> #                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..

Alan G.


More information about the Tutor mailing list