「Python入門」math.ceil()で小数点以下を切り上げるサンプル

サンプルコード
#!/usr/bin/python3
import math

print (“math.ceil(-45.17) : “, math.ceil(-45.17))
print (“math.ceil(100.12) : “, math.ceil(100.12))
print (“math.ceil(100.72) : “, math.ceil(100.72))
print (“math.ceil(math.pi) : “, math.ceil(math.pi))

実行結果
math.ceil(-45.17) : -45
math.ceil(100.12) : 101
math.ceil(100.72) : 101
math.ceil(math.pi) : 4

Python

Posted by arkgame