How can I store and pass the contents of r
from main
to two
? It will print r
if I set it to a fixed value; but how do I do it with variable contents? I tried random.getstate
/setstate
but it was saying "function object not subscriptable".
import random
from random import randrange
def main():
r = random.randrange(1,13,1)
print (r)
r = random.randrange(1,13,1)
def two():
if r==7 or r==11:
print (r)
else:
print (r)
main()
two()