I have multiple functions, the first one generates a random number, the others use the value of the first one. But I want to fix the return value of the first function and use it in the rest of my code
how can I do this without the random changes every time I call the other functions?
import random
def list():
return [i for i in range(1, 11)]
def fun1():
return random.choice(list())
def fun2():
return 2 + fun1()
def fun3():
return 4 + fun1()
print(fun2(), fun3())
Aucun commentaire:
Enregistrer un commentaire