• Python Basic Math Functions
    • Built-ins
      ##
      # -*- coding: utf-8 -*-

      # All numbers.Real types (int, long, and float) also include the following operations:
      print '-'*10, 'math.trunc(x), round(x), math.floor(x), math.ceil(x)'
      import math
      x = 2.4
      y = 2.6
      print math.trunc(x), math.trunc(y) # 버림
      print round(x), round(y) # 반올림
      print math.floor(x), math.floor(y) # 내림
      print math.ceil(x), math.ceil(y) # 올림

      ##


+ Recent posts