from random import shuffle, sample
def randomly_sample_list(list):
"""
Randomly samples a random number of elements from a list
"""
shuffle(list)
return sample(list, sample(xrange(len(list) + 1), 1)[0])
Conteúdo para você se capacitar em programação
from random import shuffle, sample
def randomly_sample_list(list):
"""
Randomly samples a random number of elements from a list
"""
shuffle(list)
return sample(list, sample(xrange(len(list) + 1), 1)[0])