dimanche 12 juin 2022

distribution 2 lists random to another 2 lists

I have two list A and B ,

and P1,P2

and I need to take A,B and randomly distribution them to the two lists P1,P2

A = [ A1,A2,A3,A4 = "A1","A2","A3","A4" ]

B = [n101,n102,n103,n104 = "101","102","103","104"]

this loop should distribution the lists 4 times randomly unitll all P1 and P2 get filled up randomly

for i in range(4):
    if(i <= 3) and a == 3:
        P1 = range(A1,A2,A3,A4,n101,n102,n103,n104)
        a += 1
    
    if(i <= 3) and b == 3:
        P2 = range(A1,A2,A3,A4,n101,n102,n103,n104) 
        b += 1
    

expected result

P1 = A4,101,104,A2
P2 = 102,A3,103,A1

P1,P2 random distribution from A,B




Aucun commentaire:

Enregistrer un commentaire