+ 1
How do I get rid of a .0 at the end of a number
Every time I'm doingnumber code it ends up having a .0 at the end
5 Respuestas
+ 4
Orber playz in Python, whenever you divide by using the / operator, the result is always a floating point data type. Consequently, the rest of the expression becomes floating point, too.
You can get an integer result if:
👉 both operands of the division are integer
AND
👉 you replace / with the // operator which is the floor division operator.
💡Another way is to pass the result into the int() function.
+ 4
As Brian said
print(int(2 * 4 - 8 / 2 - 4))
+ 3
Orber playz ,
-> it would be helpful if you tell us what programming language you are using.
-> please also post a link to your code.
+ 2
Python code