What's the fastest way to concentrate two int into one decimal.
eg.
a=100
b=10
to get = 100.10
Thanks.
What's the fastest way to concentrate two int into one decimal.
eg.
a=100
b=10
to get = 100.10
Thanks.
Convert them into strings and then add them and again convert them
c = float(str(a) + '.' + str(b))
Output:
100.10
If for some reason you don't want to use string concatenation you can do the following:
from math import log10, floor, pow
c = a + (b/(pow(10, floor(log10(b) + 1))))
Not sure if it is any more efficient. You can also import from numpy or import all of either numpy or math:
import numpy
c = a + (b / (numpy.power(10, numpy.floor(numpy.log10(b) + 1))))