samedi 22 juillet 2017

How to format and select randoms from a range in python

how do I select one of the produced decimal values and cast it to a variable.

for i in range(10):
    print (random.random() * (0.909 - 0.101) + 0.101)

Also how do i make that variable have only three decimal place it has to be in the variable not the print I should then be able to simply do this instead of generating the decimals in the print i would like to do it in a variable and choose a value?

print = (myVar)




Aucun commentaire:

Enregistrer un commentaire