Python int() to the nearest value -


the way python int()function works rounds number smallest value.

such 4.99 = 4

what can if want 4.99 equal 5?

int() truncates float values, removing non-integral portion of number. looking rounding instead.

you can use round() function that:

>>> round(4.99) 5 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -