I want to use random.random() to generate random floats and modify the output with some math so that, in the end, you get -100 to +100. Using the math I want to use multiplication and subtraction to generate three random floating point numbers within a range of -100 to +100.
here is my code:
import random
random_float = (random.random())
print("First random float between -100 and +100:", random_float - 10)
print("Second random float between -100 and +100:", random_float * 70)
print("Third random float between -100 and +100:", random_float * 100)
here is my output:
First random float between -100 and +100: -9.932043497731886
Second random float between -100 and +100: 4.756955158768027
Third random float between -100 and +100: 6.795650226811468
does this look right?
Aucun commentaire:
Enregistrer un commentaire