I am trying to add elements and their count in a list to a dictionary, but getting Type Error. Here is my code :
v= ["a","b","c","b","a"]
res= {}
for i in set(v):
res.update( i = v.count[i] )
print(res)
The error I am getting is:
TypeError: 'builtin_function_or_method' object is not subscriptable