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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -