4 ms·
They simply rounded the weights in pounds to the next hundred which resulted in the extra 644lbs. Python code: import math def roundup(x): return int
by noobie 10y ago
They simply rounded the weights in pounds to the next hundred which resulted in the extra 644lbs.
Python code:
import math
def roundup(x):
return int(math.ceil(x / 100.0)) * 100
materials_in_kgs = [12750000,6090000,5420000,2050000,1340000,86000,18000,20000,59000,2000,3000,1000]
materials_in_lbs = [i*2.204 for i in materials_in_kgs]
materials_in_lbs_rounded = [roundup(i) for i in materials_in_lbs]
print sum(materials_in_lbs_rounded)
- tacos 10y agoWinner! Plus style points for providing code.
- iolothebard 10y ago342343
- noobie 10y agoI am the same person.
- iolothebard 10y ago23433234
- noobie 10y agoThere's a difference between pointing out the existence of a similar comment on the post and stating that I have stolen the comment. Assumptions can make fools of us all. How do you suggest that I make it clear? Keybase doesn't allow for G+ verification.
- iolothebard 10y ago1241241
- rocky1138 10y agoGood work! Slight nitpick: the author gave you credit in an update but neglected to link to your comment. Thankfully it wasn't hard to find.
- jxy 10y agoTheir marketing decision is really odd. I guess the engineer that came up with kg numbers decided to round it in 1000kg, which is reasonable to me. Whoever got the number don't like kg, and converted to lb. Someone else adding the number up actually counts in 100lb, and thinks it's better just to round up. And yeah, the last two zero is fishy, I first tried to do a simple round, and wondered where's the extra 600. It's always fun to write it in a different language: 100×+/⌈.01×2.204×12750000 6090000 5420000 2050000 1340000 86000 18000 20000 59000 2000 3000 1000