Write a python function to break a list into chunks of size N use generator


Topic: Write a python function to break a list into chunks of size N use generator

Solution

my_list = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'] 
def divide_chunks(l, n): 
	# looping till length l 
	for i in range(0, len(l), n): 
		yield l[i:i + n] 



List all Python Programs