I am new to python, so I expect that I am missing some basic knowledge of types here. I am trying to create a string where I take a floating point number and replace decimal point with a string. In doing so I tried calling a line of code that is equivalent to:
int(pow(10, 1)*(5.1%1)))
But if you run this code:
x = pow(10, 1)*(5.1%1)
print(x)
print(type(x))
print(int(x))
print(int(1.0))
print(type(1.0))
It returns:
1.0
<type 'float'>
0
1
<type 'float'>
I assumed there is a type problem here but they are both type float. So why does int(x) return zero but not int(1.0)?