dimanche 15 novembre 2020

Random sampling from a 2d list w/o numpy

i have a huge dataset but to simplify the problem, think about a 4x4 2d list.

want make a new list with 5 elements which is choosen by randomly from the 4x4 list without using numpy or any addional libraries.

edit:

[['j', 'k', 'z','p'],
 [1,6,8,9],
 [8,True,0,'a'],
 [66,'False', '12', '5]]

i want to pick 5 elements of that list ramdomly with random library functions

output maybe like a new list of choosen elements:

['j', 'False', 'a', 8, 66]

hope that it's clear enough.




Aucun commentaire:

Enregistrer un commentaire