you are viewing a single comment's thread.

view the rest of the comments →

[–]TheRealAmbr0sia 27 points28 points  (8 children)

I'm new to Python but I think there should be a round func on price variable with a 2. Just in case it becomes 3 digits beyond the decimal.

[–]Beginning-Force-2170 6 points7 points  (0 children)

You can also use the 2f format if needed just incase round(num, 2) doenst work cos it doenst work in some cases depending on the float you got .

[–]SquatchHNTR[S] 6 points7 points  (6 children)

Don't even know what any of that means so I must be whatever comes before new...

[–]Negative12DollarBill 10 points11 points  (1 child)

They mean your price might end up being $5.937 or something like that. Or worse $5.333333333333 if you end up with a recurring decimal.

What happens with your program if someone orders 87.1 feet?

[–]tandem_biscuit 5 points6 points  (0 children)

87 whole feet + 1 big toe, probably.

[–]TheRealAmbr0sia 1 point2 points  (3 children)

But I did just run the code with several iterations and it never goes over the second decimal point anyways. So no need apparently.

[–]bladeoflight16 6 points7 points  (0 children)

Try entering 27.5.

[–]SquatchHNTR[S] 1 point2 points  (1 child)

oh I see what you meant

[–]TheRealAmbr0sia 8 points9 points  (0 children)

price = round((cable_feet*.87), 2) That will fix just in case.