Python

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

6838
목차
  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 - math.isqrt() 메서드 -
module Python - math.ldexp() 메서드 -
module Python - math.lgamma() 메서드 -
module Python - math.log() 메서드 -
module Python - math.log10() 메서드 -
module Python - math.log1p() 메서드 -
module Python - math.log2() 메서드 -
module Python - math.perm() 메서드 -
module Python - math.pow() 메서드 ★ - 승수값 (= 누승값 = pow메서드 = 포오 = 파워)
module Python - math.prod() 메서드 -
module Python - math.radians() 메서드 -
module Python - math.remainder() 메서드 ★ - 나머지 반환. (= remainder메서드 = …
module Python - math.sin() 메서드 -
module Python - math.sinh() 메서드 -
module Python - math.sqrt() 메서드 -
6/9
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티
웹유틸
회원센터
홈짱닷컴 PC버전 로그인