0

I need to get results like these:

2.1421 => 2.15
2.1401 => 2.15
2.14   => 2.14
Feras Senjab
  • 211
  • 3
  • 11

1 Answers1

0

As @Jerrybibo mentioned, you'll need to use the ceil function, and to get the result to the nearest hundredths place, simply multiply your number by a hundred, run it through ceil and then divide that answer by 100. You can try it in IDLE.

>>> math.ceil(2.1421 * 100) / 100
2.15

Hope that helps.

ColorCodin
  • 101
  • 2
  • 11
  • I did not see that, actually...I had copied the answer from here and made it single line: http://stackoverflow.com/questions/8866046/python-round-up-integer-to-next-hundred – ColorCodin Apr 07 '17 at 12:43