Python math.trunc() method “returns the truncated integer part of a number.” For example, if the number is 3.14, the math.trunc() method will return 3.
Syntax
math.trunc(x)
Parameters
- x: The number to be truncated.
Return value
It returns the truncated integer part of x.
Time Complexity: O(1)
Auxiliary Space: O(1)
Example: How to Use math.trunc() Method
import math
print(math.trunc(3.14))
print(math.trunc(-1.23))
Output
3
-1
That’s it.

Ankit Lathiya is a Master of Computer Application by education and Android and Laravel Developer by profession and one of the authors of this blog. He is also expert in JavaScript and Python development.