jeudi 23 avril 2020

Swapping randomly between two lists in python

I have two lists of strings, each has 260 element. I want to mix 100 items randomly between the the two lists . the 100 I want randomly without giving specific range since I am going to do that at 100 cycles.

for example : if list a is [x1,x2,x3..,x260] and b is [y1,y2,y3..',y260]

output : a [x1,y3,y5,..] b [y1,y2,x5..].

I thought to do that with shuffling but didn't know if it is possible to do random shuffling without giving a range with only a number of items




Aucun commentaire:

Enregistrer un commentaire