Re: [Tutor] Rounding Error

2012-01-28 Thread Alan Gauld
On 28/01/12 05:55, Michael Lewis wrote: I am trying to round a float to two decimals, but I am getting the following error: Traceback (most recent call last): File "", line 1, in PaintingProject() File "C:/Python27/Homework/Labs/Lab 03_5.py", line 42, in PaintingProject print 'T

Re: [Tutor] Rounding Error

2012-01-27 Thread Devin Jeanpierre
On Sat, Jan 28, 2012 at 1:20 AM, Steven D'Aprano wrote: > And finally, we come all the way back to the beginning again and say That's > not the right way to do it! Don't round the number *outside* of the string > formatting, get the string formatting to do it for you: Reason being because repr(ro

Re: [Tutor] Rounding Error

2012-01-27 Thread Steven D'Aprano
Michael Lewis wrote: I am trying to round a float to two decimals, but I am getting the following error: Traceback (most recent call last): File "", line 1, in PaintingProject() File "C:/Python27/Homework/Labs/Lab 03_5.py", line 42, in PaintingProject print 'That will cost you $%f.'

Re: [Tutor] Rounding Error

2012-01-27 Thread Michael Lewis
Update I am trying to round a float to two decimals. > > Basically, I am writing a program to ask a user how many square feet they > need to paint. I then calculate how many cans of paint they need and will > also show the total purchase price. I've tried this two ways, and both ways > I am semi-s

[Tutor] Rounding Error

2012-01-27 Thread Michael Lewis
I am trying to round a float to two decimals, but I am getting the following error: Traceback (most recent call last): File "", line 1, in PaintingProject() File "C:/Python27/Homework/Labs/Lab 03_5.py", line 42, in PaintingProject print 'That will cost you $%f.' %(round(5.6523),2) Typ