vendredi 10 juillet 2020

Generating and printing random multiple lists in python

I want to generate multiple random lists and print them. How shall I append each list uniquely with every loop? The code below doesn't append the list that is being generated with the empty lists. It simply prints the empty lists.

import numpy as np
a,b,c,d,e=[],[],[],[],[]
for i in range(0,4):
    j=np.random.randint(0,15,size=7)
    [a,b,c,d,e].append(j)
print(a,b,c,d,e)



Aucun commentaire:

Enregistrer un commentaire