+ 1

Can anyone tell how to round off floats

29th Aug 2023, 7:09 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar
4 Antworten
+ 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
29th Aug 2023, 9:56 AM
Lothar
Lothar - avatar
29th Aug 2023, 7:57 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 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
29th Aug 2023, 7:59 AM
Angela
Angela - avatar
+ 1
Thank you
30th Aug 2023, 5:10 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar