[Tutor] my program problem!

Alan Gauld alan.gauld at btinternet.com
Mon Nov 27 00:41:45 CET 2006


"Alan Gilfoy" <agilfoy at frontiernet.net> wrote
> So sleep(10) would simply be a shorter snippet of code for that 
> purpose?

sleep just gices a long pause before quitting, usually enough
to read the output.

> The \n thing might be handy if I was short on space, but I don't 
> mind
> separate 'print' lines, I find that my code seems easier to read 
> that
> way. (at least to me)

Consider triple quoted strings too. String formatting works with these 
too:

print """
This is a long text message,
It includes new lines.
It also shows the result of some interpolated values here:

The sum of %d and % d is %d
""" % (4,5,4+5)


I find that more readable than lots of \ns or lots of print
statements.

Alan G. 




More information about the Tutor mailing list