Does anyone know how to convert int
to float
.
For some reason, it keeps on printing 0. I want it to print a specific decimal.
You can literally convert it into float using:
float_value = float(integer_value)
Likewise, you can convert an integer back to float datatype with:
integer_value = int(float_value)
Hope it helped. I advice you to read "Build-In Functions of Python" at this link: https://docs.python.org/2/library/functions.html