Untitled
unknown
python
2 years ago
549 B
4
Indexable
Never
l1 = [[1,2,3,4,4,4,4,'a', 'a', 'b'], [4,4,4,4,'a', 'a', 'b'], [1,2,3,4,'a', 'a', 'b']] dict2 = {} for elem in l1[1]: if elem in dict2: dict2[elem] += 1 else: dict2[elem] = 1 for elem in l1[2]: if elem in dict2: dict2[elem] += 2 else: dict2[elem] = 2 print(dict2) dict = {} for n in l1: for z in n: if z in dict: dict[z] += 1 else: dict[z] = 1 print(dict) list_of_values = list(dict.keys()) print(list_of_values)