dict from list comprehension code example
Example 1: dictionary comprehension python
square_dict = {num: num*num for num in range(1, 11)}
Example 2: dict comprehension
# Dictionary comprehension
{i:i*2 for i in range(10)}
square_dict = {num: num*num for num in range(1, 11)}
# Dictionary comprehension
{i:i*2 for i in range(10)}