In python, is there anyway to have a variable be a different random number everytime?
- by woah113
Basically I have this:
import random
variable1 = random.randint(13, 19)
And basically what that does is assign variable1 a random number between 13 and 19. Great.
But, what I want it to do is assign a different random number between 13 and 19 to that variable every time it is called. Is there anyway I can do this?
If I'm not being clear enough here's an example:
import random
variable1 = random.randint(13, 19)
print(variable1)
print(variable1)
print(variable1)
And the output I want would look something like this:
./script.py
15
19
13
So yeah, anyway I could do this in python? (More specifically python3. but the answer would probably be similar to a python2 answer)