Hello Michael On 7 June 2011 21:10, Michael bridges <micha_el2...@yahoo.com> wrote:
> ok, will attempt to clarify. > i want to out put of two numbers [int or float or anything] to be x.xx not > x.x. > i want two numbers after the decimal not one. > > Alan's already given you exactly the correct answer. Have you tried his suggestions? What did you not understand or what problems did you run into? Here's a little example from an interactive Python interpreter session which shows you how you can play with these concepts to help clarify your understanding: Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> res = 10/float(20) >>> res 0.5 >>> "%f" % res '0.500000' >>> "%7.3f" % res ' 0.500' >>> str = "%6e" % res >>> str '5.000000e-01' >>> print str 5.000000e-01 >>> Regards, Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor