I have 2 nested lists and I want to write some code that will run through each sub-list in both lists, and group together any elements that appear together in both lists. The project I am working on actually has huge nested lists, so I have created the following 2 lists to simplify the problem a little (I only have a year of experience in python). If a function can be made that groups together elements in these 2 lists, I can then apply the function to the actual project. This question may be similar to: Find items that appear together on multiple lists, but I could not understand the code written in that question, and as I said, I'm relatively new to python.
my_list = [['a', 'd', 'l'], ['c', 'e', 't'], ['q', 'x'], ['p', 'f', 'd', 'k']
sec_list = [['f', 'd', 'w', 'a'], ['c', 'e', 'u', 'h'], ['q', 'x', 'd', 'z'], ['p', 'k']]
##The output should be something like:
[['a', 'd'], ['c', 'e'], ['q', 'x'], ['p', 'k'], ['f', 'd']]```
Thanks