Just went through list, dictionary, set comprehensions and understood lambda expressions but I'm unable to use them to capture the number of occurrences of integers in a nested list as illustrated in the example below. So, is there a solution with comprehensions or lambda expressions to compute it or is it beyond the capability of such constructs? If it's not possible, then what's the intuition for why it cannot be achieved with comprehensions/lambda expressions?
lst = [[0,1],[1,2],[3,4],[0,5]]
result = {0:2, 1:2, 2:1, 3:1, 4:1, 5:1}
I'm currently using a double for loop to do the computation.