Iterador en Python - generar partición
Esto también te interesa!
#2
def random_partition(k, iterable): results = [[] for i in range(k)] for value in iterable: x = random.randrange(k) results[x].append(value) return results
def random_partition(k, iterable): results = [[] for i in range(k)] for value in iterable: x = random.randrange(k) results[x].append(value) return results