| 1 | initial version |
A better data structure than lists to make intersectoins is set, so you can first transform your list of lists into a list of sets:
sage: Lset = [set(l) for l in L]
sage: Lset
[{'B', 'C', 'D', 'E'},
{'A', 'C', 'D'},
{'A', 'B', 'D', 'E'},
{'A', 'B', 'C', 'D'}]
Then, you can pop the first set of your list to start with:
sage: s = Lset.pop()
sage: s
{'A', 'B', 'C', 'D'}
sage: Lset
[{'B', 'C', 'D', 'E'}, {'A', 'C', 'D'}, {'A', 'B', 'D', 'E'}]
Now you can intersect s with the remaining sets in Lset:
sage: s.intersection(*Lset)
{'D'}
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.