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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

java - How to implement an entity bound odata action in olingo v4.3 -