I am having problem rounding floating value to a decimal number greater than 1.
def float_generator(size=6, chars = 6):
return random.uniform(size,chars)
and i tried
target.write(str(float_generator(7,3)))
the above returns random float to 1 decimal num like 1.2222 , 1.333333 I want to generate 7 decimal and 3 points as illustrated in the 7,3
i tried rounding off below. It round up the points instead .
target.write(str(format(float_generator(7,3),'.3f')))
Please how do i achieve 12345432.123 instead of 1.222343223 ? Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire