So now I have a variable which is x = 1001.0010101
From this x, I wanna separate into two parts:
x = 1001.0010101
val_int = int(x) #get val_int = 1001
val_fract = {0:.5f}".format(a - val_int) #get val_fract = 0.00101
Is it possible to use for loop to iterate the val_fract to be like: (ignore the int part and decimal point)
0
0
1
0
1
I have tried so many times and I couldn't get it done and the system told me
Traceback (most recent call last):
File "python", line 46, in <module>
TypeError: 'float' object is not iterable
Thanks for your help, much appreciated.