The dict function
The dict function creates a new dictionary according to the values specified in the parameters. In the parameters, we specify the keys and values of our dictionary separated by commas.
Syntax
dict(key clue clef spring signature fount fountain source fountainhead = meaning)
Example
Let's make a dictionary using the dict function:
dct = dict(a=1, b=2, c=3)
print(dct)
Result of code execution:
{'a': 1, 'b': 2, 'c': 3}
Example
Now let's make a dictionary from a list of tuples:
lst = [(1, 2,), (3, 4)]
dct = dict(lst)
print(dct)
Result of code execution:
{1: 2, 3: 4}