"W W" <[EMAIL PROTECTED]> wrote

output = "At an average weekly savings of $%.02f, your monthly savings will be $%.02f. \n Your annual savings will be $%.02f." % (diff, monthly_savings,
annual_savings)
print output.

As you can see, it's very much longer than the 72 characters suggested in
the PEP 8 found here: http://www.python.org/dev/peps/pep-0008/

Use a triple quoted string for multiline output

output = """
At an average weekly savings of \t$%.02f,
your monthly savings  will be     \t$%.02f.
Your annual savings will be       \t$%.02f.
""" % (diff, monthly_savings, annual_savings)

print output


I know it would be fairly trivial to split it up into several strings, and
concatenating or printing each one.

Multiline strings are designed to save you having to do that.

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to