Skip to content
Advertisement

Tag: nested-lists

Remove duplicate value on nested list python

I have a problem here when I want to remove duplicate in a list that has a nested list, how can I remove the duplicate value from list? What I got here from my script, it can remove a duplicate, but the nested list has a different result from what I expect. This is my script: Result: Expected Result: Answer

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 index in nested list

I am trying to create a function that will take as input a nested list and an item, and return a list of indices. For example list = [0, 5, [6, 8, [7, 3, 6]], 9, 10] and item = 7 should return [2, 2, 0], since list[2][2][0] = 7 my code should work since […]

Advertisement