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.
- x: The number to be truncated.
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))