0

I'm working with Python 3 and I have a dictionary:

{'investment': [2,62,634,654], 
'companies': [2, 30, 62, 53, 66, 279, 281],
'products': [2, 30, 49,128,562,62]
 .
 .
 .
}

I don't know the size of dictionary. (It changes according to the input taken from the customer.)

The question is how can I fetch the interceptions of elements of the dictionary as an output? For the sample the final output should be [2,62]

baduker
  • 19,152
  • 9
  • 33
  • 56
  • 3
    `set.intersection(*map(set,d.values()))` – Chris_Rands Mar 05 '18 at 09:02
  • Hi,thanks for your answer. What about the nested list [[5,26],[6,121 ]] ? The set.intersection(*map(set,d.values())) get an error like TypeError: unhashable type: 'list' if the items which we want to compare also not an integer or string but a list. – Ahmet Mithat Mar 07 '18 at 21:51

0 Answers0