Re: [Tutor] need help reading the code

2014-07-07 Thread Alan Gauld
On 07/07/14 19:29, keith papa wrote: # decimal (.) precision of 3 for float '0.333' >>> print '{0:.3f}'.format(1.0/3) The best way to see how this works is to try it with different values: >>> print('{0:.3f}'.format(1.0/3)) 0.333 >>> print('{0:.5f}'.format(1.0/3)) 0.3 >>> print('{0:.1f}'.fo

Re: [Tutor] need help reading the code

2014-07-07 Thread Alan Gauld
On 07/07/14 19:29, keith papa wrote: Please post in plain text and avoid attachments if possible. Just paste code directly into the email. I've had to cut n paste everything to write this which is a pain... >>> print '{0} was {1} years old when he wrote this book'.format(name, age) >>> print '

[Tutor] need help reading the code

2014-07-07 Thread keith papa
# Hi am leaning python with A Byte of Python - Swaroop CH and am a little confused with The format method. So I leaned that printing the code: >>>age = 20 >>>name = 'Swaroop' >>>print '{0} was {1} years old when he wrote this book'.format(name, age) >