Skip to content

Decimal to int Python | Example code

  • by

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))


Decimal to int Python

Do comment if you have any doubts or suggestions on this Python conversation code.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.