Is there any way to calculate the counting of names in the list?
The following example is written by using the method of count().
Then, the outcome should be the dictionary as the same output.
Attention: do not use built-in count() method and should return a dictionary. If the list is empty, it will return an empty dictionary.
a=['Mary', 'David','Grace','Curtis','Alice','Joe','Grace']
# use count
print(dict(map(lambda x : (x , list(a).count(x)) , a)))
output: {'Mary': 1, 'David': 1, 'Grace': 2, 'Curtis': 1, 'Alice': 1, 'Joe': 1}