Skip to content
Advertisement

Tag: list

How to concatenate a list of sublists equally chunked

I have a list that contains sublists of two different types of items (for instance, cats and dogs). I also have a function chunk(list, n_sublists) that splits the list into n_sublists of equal size. Then, i’d like to create a final list that merges the chunked lists from each type. An example: I hope the example makes it clear. However,

Finding unique elements from the list of given numbers

I have written a code which finds unique elements from the list of integers. if my given input array is [1,2,2,3,4] where n = 5 i get the output as 1,2,3,4,None but i want the output to be 1,2,3,4 can anyone tell how to fix this ? Answer Your function Distinct has no return statement so it will always return

Advertisement