I have a problem that is simple but I am not getting the solution.
I have a list of tuples, for example:
lista = [('x',2,3),('y',4,5),('x',6,7),('z',8,9)]
What I want is for him to tell me how many times x
, y
and z
appear in this list. In this case, x
appears 2
times and y
and z
appear 1
, so should return a list with [2,1,1]
.
And I wanted to resolve this with map
or reduce
.