def partition_items ( count , bin_size ) : num_bins = int ( math . ceil ( count / float ( bin_size ) ) ) bins = [ 0 ] * num_bins for i in range ( count ) : bins [ i % num_bins ] += 1 return bins
python design to break into equal sizes in 26 bins
Given the total number of items determine the number of items that can be added to each bin with a limit on the bin size .
def partition_items(count, bin_size):
	"""
	Given the total number of items, determine the number of items that
	can be added to each bin with a limit on the bin size.

	So if you want to partition 11 items into groups of 3, you'll want
	three of three and one of two.

	>>> partition_items(11, 3)
	[3, 3, 3, 2]

	But if you only have ten items, you'll have two groups of three and
	two of two.

	>>> partition_items(10, 3)
	[3, 3, 2, 2]
	"""
	num_bins = int(math.ceil(count / float(bin_size)))
	bins = [0] * num_bins
	for i in range(count):
		bins[i % num_bins] += 1
	return bins