So. I'm trying to code a program where the user inputs a list of letters i.e.
l=['a','a','a','a','b','b','r',]
and a dictionary is generated where the keys are each letter, and the values are how many occurrences the letter has in the list, i.e:
dictionary1={a:4, b:2, r:1, z:0}
Here's what I've tried so far
def list1(l):
dictionary1 = {}
for x in l:
dictionary1[x]:l.count(x)
return dictionary1
But the output comes as an empty dictionary. How should I proceed? Thanks in advance