Skip to content
Built-in Functions

dict()

Create a dictionary of key-value pairs.

dict(**kwargs)

dict() creates a dictionary. You can pass named values, another mapping, or pairs of keys and values.

Parameters

NameDescription
kwargsOptional named values to use as dictionary keys and values.

Returns

A new dictionary.

Try it

Run it and change it
scores = dict(ada=10, ben=8)
print(scores["ada"])

Related entries