Don't talk too much, just go to the code , It can be copied and run directly
def bisector_list(tabulation:list,num:int): """ Divide the list evenly into several parts :param tabulation:
list :param num: Number of copies :return: Returns a new list """ new_list = [] ''' The length of the list is greater than or equal to the number of copies ''' if len(
tabulation)>=num: '''remainder: List length divided by copies , Take the remainder ''' remainder = len(tabulation)%num if
remainder== 0: '''merchant: List length divided by score ''' merchant = int(len(tabulation) / num)
''' Split the list equally ''' for i in range(1,num+1): if i == 1: new_list.append(tabulation[:
merchant]) else: new_list.append(tabulation[(i-1)*merchant:i*merchant]) return
new_listelse: '''merchant: List length divided by score Take business ''' merchant = int(len(tabulation)//num)
'''remainder: List length divided by copies , Take the remainder ''' remainder = int(len(tabulation) % num) ''' Split the list equally '''
for i in range(1, num + 1): if i == 1: new_list.append(tabulation[:merchant])
else: new_list.append(tabulation[(i - 1) * merchant:i * merchant])
''' Add the remaining data to the previous list ''' if int(len(tabulation)-i*merchant)<=merchant: for j in
tabulation[-remainder:]: new_list[tabulation[-remainder:].index(j)].append(j)
return new_list else: ''' If the length of the list is less than the number of copies ''' for i in range(1, len(tabulation) + 1):
tabulation_subset= [] tabulation_subset.append(tabulation[i - 1]) new_list.
append(tabulation_subset) return new_list if __name__ == '__main__': a = [1,2,3,
4,5,6,7,8,9] x = bisector_list(a,4) print(x)

Technology
©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition