Use of the built-in int() function to Type conversion Decimal to int in Python. this function trims the values after the decimal point and returns only the integer/whole number part.
Note: int() function rounds off the result to an integer lesser than or equal to the input.
Decimal to int Python
Simple example code.
num = 100.00 print('type:', num, type(num)) # conversion to int num = int(num) print('type:', num, type(num))
Do comment if you have any doubts or suggestions on this Python conversation code.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.