math.trunc() function from the
math module in Python is used to truncate values and return their fragments, also called integers.
math.trunc() requires a number to be passed as a parameter. The number is returned with its decimal value removed.
TypeError is raised if the passed parameter is not a number value.
import math print(math.trunc(9.11)) print(math.trunc(1.11)) print(math.trunc(4.20))
View all Courses