declare the list - [1,2,3,5,2,4,3,1,4,2,2] Create a dictionary with unique elements as keys and their no. of occurrences as values using dict comprehension code example
Example 1: create dictionary comprehension python
{key:value for key in iterable}
Example 2: dictionary comprehension using while copying elements from another dictionary in python
dict1 = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
# Double each value in the dictionary
double_dict1 = {k:v*2 for (k,v) in dict1.items()}
print(double_dict1)