lundi 31 juillet 2017

How to return one or more items from a list?

Currently my code returns the name of the client and a random value from visit_length. I would like it to return the client name and then one or more of the elements from visit_length ie. ("Client 1", 15, 45), ("Client 2", 45, 60), ("Client 3", 30)

N = 20      
randomitems = []
visit_length = [15, 30, 45, 60]
value_range = np.arange(0, N, 1)

for i in value_range:
    visits = ("Client %d" % i, random.choice(visit_length))
    randomitems.append(visits)

Any suggestions? I thought there might be something in the random library but I haven't found anything yet.

Thank you!




Aucun commentaire:

Enregistrer un commentaire