dimanche 19 août 2018

Python sample and remove item from list

Is there a single command to randomly sample an item for a list and remove it? let say the command named cmd, I want something like that?

l = [1,2,4,6]
r = cmd(l)
r = 4
l = [1,2,6]




Aucun commentaire:

Enregistrer un commentaire