Python math.trunc() Method

Math Methods : Find the integer part of different numbers

Definition and Usage

The math.trunc() method returns the truncated integer part of a number.

Note: This method will NOT round the number up/down to the nearest integer, but simply remove the decimals.

Syntax

math.trunc(x)

Parameter Values

Parameter Description
x Required. The number you want to remove the decimal part of. If the value is not a number, it returns a TypeError

Technical Details

Return Value: An int value, representing the truncated integer parts of a number
Python Version: 1.4