Home >>Python math Module >Python math.trunc() Method
Python math.trunc() method in python is used to returns the real value truncated to an integral and a number (either an integer or a float).
Syntax:math.tanh(x)
Parameter | Description |
---|---|
x | It is required a number to remove the decimal part |
import math
print(math.trunc(1.87))
print(math.trunc(4.32))
print(math.trunc(-973.43))
import math
a = 5
b = 5.13
c = -5
d = -5.54
e = 5.12
print("trunc(a): ", math.trunc(a))
print("trunc(b): ", math.trunc(b))
print("trunc(c): ", math.trunc(c))
print("trunc(d): ", math.trunc(d))
print("trunc(e): ", math.trunc(e))