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
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
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.'
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
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