Metoden ceil i math-modulen
Metoden ceil i modulen math
avrundar tal till heltal alltid
uppåt.
Syntax
import math
math.ceil(tal)
Exempel
Låt oss avrunda talet
25.38 uppåt:
import math
print(math.ceil(25.38))
Resultat av kodkörning:
26
Exempel
Låt oss nu använda metoden ceil på talet
-4.88:
import math
print(math.ceil(-5.25))
Resultat av kodkörning:
-5