int will always truncate towards zero:

>>> a = 123.456
>>> int(a)
123
>>> a = 0.9999
>>> int(a)
0
>>> int(-1.5)
-1

The difference between int and math.floor is that math.floor returns the number as a float, and does not truncate towards zero.

Answer from Mark Rushakoff on Stack Overflow
Discussions

General way to print floats without the .0 part
I’m building SVG code using data interpolation (f-strings and .format), and I have elements (the size of the graph for one) that are internally floats but which are usually integers. But when printing floats, the .0 part is always included. Is there a standard str-interpolation idiom that ... More on discuss.python.org
🌐 discuss.python.org
19
0
May 19, 2024
How to terminate or remove the .0 point from an int.
Try using the g flag when you print it. x = 5.0 y = 5.1 print("regular print:", x, y) print("with g flag:", f"{x:g} {y:g}") More on reddit.com
🌐 r/learnpython
5
2
December 9, 2022
How to remove decimals in float?
If this is just for printing... f'{my_float:.6f}. If you actually need that level of precision, you're likely to run into rounding issues, but you could try something like this: int(my_float * (10**6)) / (10**6) More on reddit.com
🌐 r/learnpython
18
9
April 15, 2023
Python: Remove division decimal - Stack Overflow
I have made a program that divides numbers and then returns the number, But the thing is that when it returns the number it has a decimal like this: 2.0 But I want it to give me: 2 so is there an... More on stackoverflow.com
🌐 stackoverflow.com
July 15, 2013
🌐
w3resource
w3resource.com › python-exercises › string › python-data-type-string-exercise-32.php
Python: Print the following floating numbers with no decimal places - w3resource
June 12, 2025 - Original Number: 3.1415926 Formatted Number with no decimal places: 3 Original Number: -12.9999 Formatted Number with no decimal places: -13 ... Write a Python program to round a list of floats to the nearest integer and print them without decimals.
🌐
Java2Blog
java2blog.com › home › python › print number without decimal in python
Print Number without Decimal in Python [4 ways] - Java2Blog
September 28, 2022 - The round() function in Python is capable of rounding off a float up and down to the closest integer value. The following code uses the round() function to print a number without decimal in Python.
🌐
Finxter
blog.finxter.com › home › learn python blog › python print float without decimal points
Python Print Float Without Decimal Points - Be on the Right Side of Change
August 26, 2021 - How to print the number without decimal remainder? x = 123.456 print(x) # Desired output: 123 # Real output: 123.456 · Python’s built-in function int(x) converts any float number x to an integer by truncating it towards 0.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-remove-all-decimals-from-a-number-using-python
How to remove all decimals from a number using Python? - GeeksforGeeks
July 23, 2025 - We have to remove all decimals from a number and get the required output using Python. There are several ways to achieve this, depending on whether you want to simply truncate the decimal part, round it or perform other manipulations. For example, number is 12.345 then result is 12. int( ) is a built-in function used to convert any value into an integer number. ... a = 44.560 b = 856.9785623 c = 9999.99 # Type conversion float to int x = int(a) y = int(b) z = int(c) print("Number1 = ", x) print("Number2 = ", y) print("Number3 = ", z) # type() function returns the data type print(type(a)) print(type(x))
🌐
Bobby Hadz
bobbyhadz.com › blog › python-get-number-without-decimal-places
Remove the Decimal part from a Float in Python | bobbyhadz
April 9, 2024 - Copied!result_1 = int(3.999) ... # 👉️ -3 · The int() class truncates floating-point numbers toward zero, so it will return an int that represents the number without the decimal places....
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › how to terminate or remove the .0 point from an int.
r/learnpython on Reddit: How to terminate or remove the .0 point from an int.
December 9, 2022 -

Hello everyone,

I am still new to python and learning.

So I practiced some exercises and made an app that calculates the percentage from the number the user enters.

My question use, how can I terminate the .0 part if the user enters an Int and keep the decimal part if they enter a float?

so for example, 5% of 100 is 5 ( Int)

and 5.1% of 100 is 5.1 (float)

🌐
Quora
quora.com › How-can-I-print-float-without-dot-Like-if-I-put-value-in-float-float-f-5-When-I-print-f-it-shows-5-0-but-what-I-want-is-to-print-only-5-How-can-I-do-that
How to print float without dot? Like if I put value in float; float f = 5. When I print f, it shows 5.0, but what I want is to print only 5. How can I do that - Quora
Like if I put value in float; float f = 5. When I print f, it shows 5.0, but what I want is to print only 5. How can I do that? ... You can print a float without the decimal point by formatting the output to show no fractional ...
🌐
Javatpoint
javatpoint.com › how-to-remove-decimal-in-python
How to Remove Decimal in Python - Javatpoint
How to Remove Decimal in Python with python, tutorial, tkinter, button, overview, entry, checkbutton, canvas, frame, environment set-up, first python program, operators, etc.
Top answer
1 of 2
1

Use print(str(Decimal)) instead of print(Decimal) :

print [str(i) for i in norm]
['0', '0.1', '0.2', '0.3', '0.4']
2 of 2
1

To print Decimals without the 'Decimal' appearing, you could subclass Decimal and override __repr__:

>>> class MyDecimal(Decimal):
...   def __repr__(self):
...     return str(float(self))
...
>>> x = Decimal(4.1)
>>> x
Decimal('4.0999999999999996447286321199499070644378662109375')
>>> y = MyDecimal(5.3)
>>> y
5.3

However, when you do any operation with them, the repr goes back to it's original form:

>>> y = MyDecimal(5.3)
>>> z = MyDecimal(4.2)
>>> y + z
Decimal('9.500000000000000000000000000')

To always get MyDecimal in such cases, you would need to override all of Decimal's operations to return a MyDecimal obeject instead of Decimal.

Note that what we're seeing here is the representation of the decimal. And you will need to leave that as is when doing other operations. Or always convert to float when using it elsewhere. From the docs:

Decimal objects cannot generally be combined with floats in arithmetic operations: an attempt to add a Decimal to a float, for example, will raise a TypeError. There’s one exception to this rule: it’s possible to use Python’s comparison operators to compare a float instance x with a Decimal instance y. Without this exception, comparisons between Decimal and float instances would follow the general rules for comparing objects of different types described in the Expressions section of the reference manual, leading to confusing results.

🌐
Real Python
realpython.com › how-to-python-f-string-format-float
How to Format Floats Within F-Strings in Python – Real Python
April 24, 2024 - Remember to consult the Python documentation if you need help: ... >>> sample = -12345.6789 >>> print( ... # Write your solution here ... ) |-12,345.68 | | 12,345.68 | Task 5: Start with result = 5 * 3, then see if you can produce the output shown without encoding a literal decimal point symbol (.) onto the end of the f-string.
🌐
GitHub
gist.github.com › jackiekazil › 6201722
How do I round to 2 decimals in python? · GitHub
to round float to 3 significant figures without dealing with Decimal module: >>> '%s' % float('%.3g' % 3.141592654) '3.14' %s required to prevent python from printing float in e- scientific notation · Ref: https://stackoverflow.com/questions/3410976/how-to-round-a-number-to-significant-figures-in-python ·