mercredi 25 octobre 2017

replacing a value in list by another in python

I need to define a computer turn, that picks random number in the list and decreases its value by 1-3 but the value can't go under 0. And the function is repeating until sum(nim) = 0. Here is my code:

def nim():
import random
stack = random.randint(1,20)
num = [random.randrange(3,21) for _ in range (stack)]




Aucun commentaire:

Enregistrer un commentaire