Skip to content
Advertisement

Tag: any

Checking if list element in list of lists and returning sublist

I have two lists and want to return those sublistst of list2 that contain elements of list1. So far I tried using any: and a naive approach But I only managed to repeat empty list. The result should be Not sure, where I’m going wrong. Is there maybe a way using list comprehensions or mixing list comprehensions and ‘any’ function?

Advertisement