mercredi 9 octobre 2019

How to pull a certain number from a list and use it in a mathematical expression? [on hold]

How do I pull a random number from the list toss and add it to another number from the same list? I tried using random.choice, adding it together twice and making it into a variable (sum_of_two_dice). When I printed sum_of_two_dice, I got a result containing the sum, but I got it 6 sums. I believe that it is giving back the same number of sums as there are values in the list. But I only want one for every run in the for-loop.

![1]: https://i.stack.imgur.com/mR4v4.png The argument that I have passed onto dice is for the number of times I would like the program to loop for.




Aucun commentaire:

Enregistrer un commentaire