mardi 27 octobre 2020

How can I save the random output to use it in another function in python

I am new to python3 I am trying very hard to add the output of the function, is there any way that I can save an output of an random integer so that i can altogether add it please help me.

def dice():
    import random
    rollball = int(random.uniform(1, 6))
    return (rollball)

def dice2():
    import random
    rollball = int(random.uniform(1, 6))
    return (rollball)

print(dice())
input("you have 10 chances left")
print(dice2())
input("you have 9 chances left")
print(dice() + dice2())
#i want to print this last function but by adding only this first and second nothing else



Aucun commentaire:

Enregistrer un commentaire