filmov
tv
Code 29: trunc() in Python | Remove Decimal part in a value | Math Module | 365 days in Code

Показать описание
Mistake - Ignore the "floor", it will be trunc.
It simply remove the decimals part.
Ex - trunc of 7.9 will be 7.
Ex - trunc of 19.1 will be 19.
Ex - trunc of -7.3 will be -7.
Code -
import math # Import the math module
# Thanks
It simply remove the decimals part.
Ex - trunc of 7.9 will be 7.
Ex - trunc of 19.1 will be 19.
Ex - trunc of -7.3 will be -7.
Code -
import math # Import the math module
# Thanks