• 회원가입
  • 로그인
  • 구글아이디로 로그인

[module] Python - math.trunc() 메서드 ★ - 정수 부분 반환. (= trunc메서드 = 트렁크)

6839  
목차
  1. math.trunc() 예제
  2. math.trunc() 정의
  3. math.trunc() 구문

 

math.trunc() 예제 - 정수 부분 반환.

 

import math

print(math.trunc(1.23)) # 1

print(math.trunc(4.56)) # 4

print(math.trunc(-7.89)) # -7

 

 

math.trunc() 정의

 

지정 숫자의 정수 부분 반환.

 


 

※ 반올림 하지 않고, 소수 부분만 제거.

※ Python 1.4 이상. 

 

 

math.trunc() 구문

 

math.trunc(x)

 


[매개변수]

 

 

x

필수. 소수 부분을 제거할 숫자.

※ 숫자 아니면, TypeError 발생.

 



분류 제목
module Python - cmath 모듈 메서드・상수 종류 (※ 복소수 모듈)
module Python - cmath.acos(x) 메서드 -
module Python - cmath.acosh(x) 메서드 -
module Python - cmath.asin(x) 메서드 -
module Python - cmath.asinh(x) 메서드 -
module Python - cmath.atan(x) 메서드 -
module Python - cmath.atanh(x) 메서드 -
module Python - cmath.cos(x) 메서드 -
module Python - cmath.cosh(x) 메서드 -
module Python - cmath.exp(x) 메서드 -
module Python - cmath.isclose() 메서드 -
module Python - cmath.isfinite(x) 메서드 -
module Python - cmath.isinf(x) 메서드 -
module Python - cmath.isnan(x) 메서드 -
module Python - cmath.log() 메서드 -
module Python - cmath.log10() 메서드 -
module Python - cmath.phase() 메서드 -
module Python - cmath.polar() 메서드 -
module Python - cmath.rect() 메서드 -
module Python - cmath.sin(x) 메서드 -
22/24
목록
찾아주셔서 감사합니다. Since 2012