Is it possible to use an integer stored in a variable to serve as the decimals of a float?
The below code of course won't work, but it is added to demonstrate the concept.
a = 5
b = 1.a
CodePudding user response:
Yes, in a way.
Just use b = 1 (a / 10)
CodePudding user response:
Have you tried:
a=54
dec=len(str(a))
b=1 (a/(10**dec))
print(b)
output:
1.54