Essentially I'm writing a function that receives a list as input and returns a dictionary that counts how many times the data in the list is repeated.
#Example:
count_occurrences(["a", "b", "c", "a", "a," "b"])
#output: 
{"a" : 3, "b" : 2, "c": 1}
My solution so far has been:
def count_occurrences(a_list):
    count_list = {}
    for i in a_list:
        if i not in count_list:
            count_list[i] = 1
        else: 
            count_list[i] += 1 
    return count_list 
But I'm wondering if there's a way to use Dictionary Comprehension to shorten/optimize this script.
 
     
    