+ 1
Can anyone tell how to round off floats
4 Respostas
+ 7
Arrchith ,
there is also an other rounding function called floor(). to use it, we need to import it from the math modul.
> the python docs are saying that floor() function is used to round DOWN a given number to the nearest integer that is less than or equal to the original number.
the result is an integer number.
sample:
https://code.sololearn.com/cI5odCM6762W/?ref=app
+ 4
Arrchith
Use searchbar before asking any questions..
https://code.sololearn.com/W0uW3Wks8UBk/?ref=app
See this what I found after searching..
https://www.tutorialspoint.com/How-do-you-round-up-a-float-number-in-JUMP_LINK__&&__Python__&&__JUMP_LINK
+ 2
if you want to roundup to the next whole number, you can use
import math
print(math.ceil (3.34)
output gives 4
https://code.sololearn.com/cKvAs7IJsZQ5/?ref=app
+ 1
Thank you