Integer in python | Sololearn: Learn to code for FREE!


Integer in python

When doing numeric operation in python it always returns float. But what if i need integer . Even if the result is a whole number it returns float. Like if the result is 7 it returns 7.0. But i want integer. How can i do that. ( Is there any way to transform float into int.)

9/29/2020 1:59:46 PM

Khalid Shifullah

6 Answers

New Answer

+5 Khalid Shifullah is this what u mean?


Netha_r2071 Thanks a lot bro. This is exactly what i ment.


Khalid Shifullah see the same code using round () function


Netha_r2071 thanks again😍 . dude you are too good


Use int() function 👍👍


Netha_r2071 bro what if i want the output to be rounded. Like if it is 7.8 i want 8. How i do it . import math?