zoukankan      html  css  js  c++  java
  • 4 python数学函数

     1 import math
     2 
     3 #向上取整
     4 print "math.ceil---"
     5 print "math.ceil(2.3) => ", math.ceil(2.3)
     6 print "math.ceil(2.6) => ", math.ceil(2.6)
     7 
     8 #向下取整
     9 print "
    math.floor---"
    10 print "math.floor(2.3) => ", math.floor(2.3)
    11 print "math.floor(2.6) => ", math.floor(2.6)
    12 
    13 #四舍五入
    14 print "
    round---"
    15 print "round(2.3) => ", round(2.3)
    16 print "round(2.6) => ", round(2.6)
    17 
    18 #这三个的返回结果都是浮点型
    19 print "
    
    NOTE:every result is type of float"
    20 print "math.ceil(2) => ", math.ceil(2)
    21 print "math.floor(2) => ", math.floor(2)
    22 print "round(2) => ", round(2)
    23 
    24 
    25 ###绝对值函数
    26 abs()
  • 相关阅读:
    Java线程面试题 Top 50
    抽象类
    this和super的区别
    引用传递
    【代码】递归调用
    java异常
    抽象类 final
    sublime使用技巧
    zabbix表达式
    tcpdump
  • 原文地址:https://www.cnblogs.com/2mei/p/9254030.html
Copyright © 2011-2022 走看看