x = [[1, 3], [1, 2, 9], [3, 6]]
Hello, how should I do to,count the number of each numbers inthe whole list of lists?
for example, in the list x, there is two of 1, one of 2, two of3, one of 6, one of 9?
please help in python
Solution
x = [[1, 3], [1, 2, 9], [3, 6]]d = {}for l in x: for num in l: if num not in d: d[num] = 0
OR
OR