lundi 11 septembre 2017

How to randomly replace elements of list with another list elements?

x_list = ['a', 'b', 'c', 'd', 'e']
t_list = ['z', 'y', 'u']

I want replace elements of t_list with elements of x_list, "randomly". I researched and I tried something but replace() didn't work for lists. For example; x_new0 = ['a', 'z', 'c', 'y', 'u], x_new1 = ['z', 'y', 'c', 'd','u']. How can I do this?




Aucun commentaire:

Enregistrer un commentaire