In this we are going to see a basic program to split list into multiple list in Python Programming Language.
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list2 = []
def divide_list(list1):
for i in range(0, len(list1), 2):
yield list1[i:i+2]
for i in divide_list(list1):
list2.append(i)
print(list2)
# Coded By DHIRAJ SHELKE
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP