Python rounding up float number -


this question has answer here:

i need results these:

2.1421 => 2.15 2.1401 => 2.15 2.14   => 2.14 

as @jerrybibo mentioned, you'll need use ceil function, , result nearest hundredths place, multiply number hundred, run through ceil , divide answer 100. can try in idle.

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

hope helps.


Comments

Popular posts from this blog

javascript - Knockout pushing observable and computed data to an observable array -

'hasOwnProperty' in javascript -

Trouble making a JSON string -